pentaho/pentaho-kettle · error · IllegalArgumentException

This functionality for Timestamp object has not been…

Error message

This functionality for Timestamp object has not been implemented yet

What it means

SimpleTimestampFormat.formatToCharacterIterator() deliberately rejects java.sql.Timestamp input with IllegalArgumentException because character-iterator formatting for Timestamp is not implemented; the class only intends full support for its documented format/parse paths. This is a guard against silently using the incomplete parent (SimpleDateFormat) implementation.

Solutions

  1. Use format(Object) / format(Timestamp, StringBuffer, FieldPosition) instead of formatToCharacterIterator
  2. Convert the Timestamp to java.util.Date only if you truly want the super SimpleDateFormat behavior (not recommended with this class)
  3. Catch IllegalArgumentException and fall back to standard SimpleDateFormat for rendering

Example fix

// before
fmt.formatToCharacterIterator(ts);
// after
StringBuffer sb = new StringBuffer();
fmt.format(ts, sb, new FieldPosition(0));
Defensive patterns

Strategy: fallback

Validate before calling

if (obj instanceof java.sql.Timestamp) { /* use fmt.format(obj, sb, pos) instead */ }

Type guard

boolean supportsCharacterIterator(Object o) { return !(o instanceof java.sql.Timestamp); }

Try / catch

try {
  return fmt.formatToCharacterIterator(obj);
} catch (IllegalArgumentException e) {
  return fallbackSimpleDateFormat.formatToCharacterIterator(obj);
}

Prevention

When it happens

Trigger: Calling formatToCharacterIterator(obj) where obj instanceof java.sql.Timestamp; it throws before checking the pattern.

Common situations: Code that formats dates generically via Format.formatToCharacterIterator encountering Timestamp values; UI code rendering Timestamp fields with attributed iterators.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/timestamp/SimpleTimestampFormat.java:296

  private int replaceHolder( StringBuffer dateBuffer, Boolean inPattern ) {
    String placeHolder = inPattern ? ESCAPED_NANOSECOND_PLACEHOLDER : NANOSECOND_PLACEHOLDER;
    int placeholderPosition = dateBuffer.indexOf( placeHolder );
    if ( placeholderPosition == -1 ) {
      return 0;
    }
    dateBuffer.delete( placeholderPosition, placeholderPosition + placeHolder.length() );
    return placeholderPosition;
  }

  /**
   * See <code>SimpleDateFormat</code> description. This is dummy method to deprecate using parent implementation for
   * <code>Timestamp</code> until it is not fully implemented.
   */
  @Override
  public AttributedCharacterIterator formatToCharacterIterator( Object obj ) {
    if ( obj instanceof Timestamp ) {
      throw new IllegalArgumentException(
        "This functionality for Timestamp object has not been implemented yet" );
    }
    if ( compatibleToSuperPattern ) {
      return super.formatToCharacterIterator( obj );
    } else {
      throw new IllegalArgumentException(
        "This functionality for specified format pattern has not been implemented yet" );
    }
  }

  /**
   * Parses text from a string to produce a <code>Timestamp</code>.
   * <p/>
   * The method attempts to parse text starting at the index given by <code>pos</code>. If parsing succeeds, then the
   * index of <code>pos</code> is updated to the index after the last character used (parsing does not necessarily use
   * all characters up to the end of the string), and the parsed date is returned. The updated <code>pos</code> can be
   * used to indicate the starting point for the next call to this method. If an error occurs, then the index of
   * <code>pos</code> is not changed, the error index of <code>pos</code> is set to the index of the character where the

View on GitHub (pinned to f3058517a1)