pentaho/pentaho-kettle · error · KettleException

SalesforceInput.Error.WrongDates

SalesforceInput.Error.WrongDates

Error message

SalesforceInput.Error.WrongDates

What it means

setCalendar() throws this KettleException when startDate is on or after endDate (compareTo >= 0). The date range supplied is inverted or degenerate, which cannot produce a valid Salesforce query window.

Solutions

  1. Ensure startDate is strictly before endDate in the step configuration.
  2. If you want a single-day window, set endDate to startDate + 1 day instead of the same instant.
  3. Validate the parsed dates in the dialog/parameters before constructing the connection.
  4. Check variable interpolation order so the start value doesn't get assigned to the end field.

Example fix

// before
GregorianCalendar start = cal(2026, 9, 13), end = cal(2026, 1, 1); // inverted
// after
GregorianCalendar start = cal(2026, 1, 1), end = cal(2026, 9, 13); // start < end
if (!start.getTime().before(end.getTime())) {
  throw new IllegalArgumentException("startDate must be before endDate");
}
Defensive patterns

Strategy: validation

Validate before calling

if (!startCal.getTime().before(endCal.getTime())) {
  throw new IllegalArgumentException("startDate must be strictly before endDate");
}

Type guard

boolean validRange = startCal != null && endCal != null && startCal.getTime().compareTo(endCal.getTime()) < 0;

Try / catch

try {
  conn.setCalendar(recordsFilter, startCal, endCal);
} catch (KettleException e) {
  if (e.getMessage().contains("WrongDates")) {
    logError("Inverted date range: swap start/end");
  }
}

Prevention

When it happens

Trigger: Calling setCalendar with endDate earlier than startDate, or with startDate exactly equal to endDate (zero-length range).

Common situations: Start/end date fields swapped in the Salesforce Input dialog; both dates defaulted to the same value from variables; timezone/locale parsing producing identical timestamps for both bounds.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/0961eae70e04aeb0. Report an issue: GitHub.

Appendix: source

Thrown at plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java:183

   */
  @Deprecated
  public void queryAll( boolean value ) {
    setQueryAll( value );
  }

  public void setQueryAll( boolean value ) {
    this.queryAll = value;
  }

  public void setCalendar( int recordsFilter, GregorianCalendar startDate, GregorianCalendar endDate ) throws KettleException {
    this.startDate = startDate;
    this.endDate = endDate;
    this.recordsFilter = recordsFilter;
    if ( this.startDate == null || this.endDate == null ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.EmptyStartDateOrEndDate" ) );
    }
    if ( this.startDate.getTime().compareTo( this.endDate.getTime() ) >= 0 ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.WrongDates" ) );
    }
    // Calculate difference in days
    long diffDays =
      ( this.endDate.getTime().getTime() - this.startDate.getTime().getTime() ) / ( 24 * 60 * 60 * 1000 );
    if ( diffDays > 30 ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.StartDateTooOlder" ) );
    }
  }

  public void setSQL( String sql ) {
    this.sql = sql;
  }

  public void setFieldsList( String fieldsList ) {
    this.fieldsList = fieldsList;
  }

  public void setModule( String module ) {

View on GitHub (pinned to f3058517a1)