pentaho/pentaho-kettle · error · KettleException

Image icon file name can not be null

Error message

Image icon file name can not be null

What it means

SwingDirectGC.getImageIcon(String fileName) throws KettleException when the requested image file name is null. The graphics context cannot attempt any file/classpath lookup without a name, so it fails fast at the start of init-time icon loading.

Solutions

  1. Find the caller in init() that passes null and fix the image name source (constant, plugin.xml, or properties lookup).
  2. Validate the image path is non-null before constructing/initializing the GC.
  3. Ensure the plugin declares its icons correctly so lookups return real paths.
  4. If the image is optional, skip the call instead of passing null.

Example fix

// before
gc.getImageIcon( props.getImageName(null) ); // KettleException
// after
String name = props.getImageName(DEFAULT_IMAGE);
if (name != null) { gc.getImageIcon(name); }
Defensive patterns

Strategy: validation

Validate before calling

if (iconName == null || iconName.trim().isEmpty()) {
  throw new IllegalArgumentException("icon name must be set before GC init");
}

Type guard

boolean hasIconName(String s) { return s != null && !s.trim().isEmpty(); }

Try / catch

try {
  gc.getImageIcon(iconName);
} catch (KettleException e) {
  if (e.getMessage().contains("can not be null")) {
    log.warn("icon name null, using default");
    gc.getImageIcon(DEFAULT_ICON);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling getImageIcon(null), or init()/drawing setup passing a null image path — e.g. a plugin/properties lookup returns null because the image constant or GUI resource key is missing.

Common situations: Custom Kettle plugin whose plugin.xml/image registration is missing; spelling mistakes in image resource keys; environment where an expected image path variable was never set before the GUI initializes.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/gui/SwingDirectGC.java:243

    errorArrow = getImageIcon( BasePropertyHandler.getProperty( "errorArrow_image" ) );
    disabledArrow = getImageIcon( BasePropertyHandler.getProperty( "disabledArrow_image" ) );

    fontGraph = new Font( "FreeSans", Font.PLAIN, 10 );
    fontNote = new Font( "FreeSans", Font.PLAIN, 10 );
    fontSmall = new Font( "FreeSans", Font.PLAIN, 8 );

    gc.setFont( fontGraph );

    gc.setColor( background );
    gc.fillRect( 0, 0, area.x, area.y );
  }

  private SwingUniversalImage getImageIcon( String fileName ) throws KettleException {
    SwingUniversalImage image = null;

    InputStream inputStream = null;
    if ( fileName == null ) {
      throw new KettleException( "Image icon file name can not be null" );
    }

    if ( SvgSupport.isSvgEnabled() && SvgSupport.isSvgName( fileName ) ) {
      try {
        inputStream = new FileInputStream( fileName );
      } catch ( FileNotFoundException ex ) {
        // no need to fail
      }
      if ( inputStream == null ) {
        try {
          inputStream = new FileInputStream( "/" + fileName );
        } catch ( FileNotFoundException ex ) {
          // no need to fail
        }
      }
      if ( inputStream == null ) {
        inputStream = getClass().getResourceAsStream( fileName );
      }

View on GitHub (pinned to f3058517a1)