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

SwingGC.getImageIcon(String fileName) — the SwingGraphics variant of the same loader — throws KettleException immediately when the requested image name is null, before attempting any file or SVG lookup.

Solutions

  1. Trace the null name to its source (constant, plugin.xml, properties) and supply the correct image name.
  2. Guard the call site with a null check and fall back to a default icon.
  3. Fix the plugin image registration so lookups return a valid path.
  4. Initialize GUI/image properties before constructing the GC.

Example fix

// before
gc.getImageIcon( getIconName() ); // returns null -> KettleException
// after
String icon = getIconName();
if (icon == null) { icon = DEFAULT_ICON; }
gc.getImageIcon(icon);
Defensive patterns

Strategy: validation

Validate before calling

if (iconName == null || iconName.isEmpty()) iconName = DEFAULT_ICON; // before GC init

Type guard

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

Try / catch

try {
  gc.getImageIcon(iconName);
} catch (KettleException e) {
  if (e.getMessage().contains("can not be null")) { iconName = DEFAULT_ICON; }
  else throw e;
}

Prevention

When it happens

Trigger: getImageIcon(null) during GC init; a null image path supplied by GUI code, e.g. a properties/plugin lookup that returned null for an icon key.

Common situations: Plugins with missing or misspelled image registrations; GUI resources not initialized before drawing; refactors that removed an image constant still referenced by init().

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/gui/SwingGC.java:249

    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)