pentaho/pentaho-kettle · error · RuntimeException

Filename not provided

Error message

Filename not provided

What it means

SwingSvgImageUtil.getUniversalImage throws RuntimeException when the filename argument is null, empty, or whitespace-only. It is a fail-fast guard before attempting to load the image from SVG or PNG sources. The error means the caller passed no filename at all, not that the file is missing on disk.

Solutions

  1. Pass a valid, non-blank filename (e.g. "images/icon.svg") to getUniversalImage.
  2. Check where the filename variable comes from — validate it is non-empty before calling.
  3. Provide a fallback default image name when the configured value is blank.
  4. Use StringUtils.isBlank(filename) as a pre-call guard to fail with a clearer app-level message.

Example fix

// before
SwingUniversalImage img = SwingSvgImageUtil.getUniversalImage(cl, cfg.getImage());
// after
if (StringUtils.isBlank(cfg.getImage())) {
  throw new IllegalStateException("Image not configured");
}
SwingUniversalImage img = SwingSvgImageUtil.getUniversalImage(cl, cfg.getImage());
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isBlank(filename)) {
  filename = DEFAULT_IMAGE;
}
SwingUniversalImage img = SwingSvgImageUtil.getUniversalImage(classLoader, filename);

Type guard

boolean valid = filename != null && !filename.trim().isEmpty();

Try / catch

try {
  img = SwingSvgImageUtil.getUniversalImage(cl, filename);
} catch (RuntimeException e) {
  img = SwingSvgImageUtil.getUniversalImage(cl, DEFAULT_IMAGE);
}

Prevention

When it happens

Trigger: Calling getUniversalImage(classLoader, null), getUniversalImage(classLoader, ""), or with a blank/whitespace filename.

Common situations: A configuration field for an image path was left empty; a variable placeholder was not substituted so the filename resolves to blank; refactoring removed the default image name.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/util/SwingSvgImageUtil.java:109

    if ( result == null ) {
      result = loadFromClassLoader( classLoader, "/" + filename );
      if ( result == null ) {
        result = loadFromClassLoader( classLoader, "ui/images/" + filename );
        if ( result == null ) {
          result = getImageAsResourceInternal( filename );
        }
      }
    }
    return result;
  }

  /**
   * Load image from several sources.
   */
  public static SwingUniversalImage getUniversalImage( ClassLoader classLoader, String filename ) {

    if ( StringUtils.isBlank( filename ) ) {
      throw new RuntimeException( "Filename not provided" );
    }

    SwingUniversalImage result = null;
    if ( SvgSupport.isSvgEnabled() ) {
      result = getUniversalImageInternal( classLoader, SvgSupport.toSvgName( filename ) );
    }

    // if we haven't loaded SVG attempt to use PNG
    if ( result == null ) {
      result = getUniversalImageInternal( classLoader, SvgSupport.toPngName( filename ) );
    }

    // if we can't load PNG, use default "no_image" graphic
    if ( result == null ) {
      result = getImageAsResource( NO_IMAGE );
    }
    return result;
  }

View on GitHub (pinned to f3058517a1)