{"record":{"id":"d32f6274d0d430dc","repo":"pentaho/pentaho-kettle","slug":"image-icon-file-name-can-not-be-null","errorCode":null,"errorMessage":"Image icon file name can not be null","messagePattern":"Image icon file name can not be null","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/core/gui/SwingDirectGC.java","lineNumber":243,"sourceCode":"    errorArrow = getImageIcon( BasePropertyHandler.getProperty( \"errorArrow_image\" ) );\n    disabledArrow = getImageIcon( BasePropertyHandler.getProperty( \"disabledArrow_image\" ) );\n\n    fontGraph = new Font( \"FreeSans\", Font.PLAIN, 10 );\n    fontNote = new Font( \"FreeSans\", Font.PLAIN, 10 );\n    fontSmall = new Font( \"FreeSans\", Font.PLAIN, 8 );\n\n    gc.setFont( fontGraph );\n\n    gc.setColor( background );\n    gc.fillRect( 0, 0, area.x, area.y );\n  }\n\n  private SwingUniversalImage getImageIcon( String fileName ) throws KettleException {\n    SwingUniversalImage image = null;\n\n    InputStream inputStream = null;\n    if ( fileName == null ) {\n      throw new KettleException( \"Image icon file name can not be null\" );\n    }\n\n    if ( SvgSupport.isSvgEnabled() && SvgSupport.isSvgName( fileName ) ) {\n      try {\n        inputStream = new FileInputStream( fileName );\n      } catch ( FileNotFoundException ex ) {\n        // no need to fail\n      }\n      if ( inputStream == null ) {\n        try {\n          inputStream = new FileInputStream( \"/\" + fileName );\n        } catch ( FileNotFoundException ex ) {\n          // no need to fail\n        }\n      }\n      if ( inputStream == null ) {\n        inputStream = getClass().getResourceAsStream( fileName );\n      }","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/core/gui/SwingDirectGC.java#L225-L261","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Find the caller in init() that passes null and fix the image name source (constant, plugin.xml, or properties lookup).","Validate the image path is non-null before constructing/initializing the GC.","Ensure the plugin declares its icons correctly so lookups return real paths.","If the image is optional, skip the call instead of passing null."],"exampleFix":"// before\ngc.getImageIcon( props.getImageName(null) ); // KettleException\n// after\nString name = props.getImageName(DEFAULT_IMAGE);\nif (name != null) { gc.getImageIcon(name); }","handlingStrategy":"validation","validationCode":"if (iconName == null || iconName.trim().isEmpty()) {\n  throw new IllegalArgumentException(\"icon name must be set before GC init\");\n}","typeGuard":"boolean hasIconName(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n  gc.getImageIcon(iconName);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"can not be null\")) {\n    log.warn(\"icon name null, using default\");\n    gc.getImageIcon(DEFAULT_ICON);\n  } else throw e;\n}","preventionTips":["Resolve image names from constants, never raw lookups that can return null.","Null-check plugin/properties lookups at configuration load time.","Validate plugin.xml image registrations during plugin startup.","Fail fast in your own config validation before GUI initialization."],"tags":["gui","swing","null-argument","kettle"],"backgroundTag":"null-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}