pentaho/pentaho-kettle · error · IllegalAccessException

Must use the messageClass, props constructor

Error message

Must use the messageClass, props constructor

What it means

VFSDetailsCompositeHelper has a no-argument constructor that unconditionally throws IllegalAccessException. The class can only be constructed with the (Class<?> messageClass, PropsUI props) constructor, so the default constructor is deliberately disabled to force callers to supply the i18n message bundle class and UI properties.

Solutions

  1. Use the two-argument constructor: new VFSDetailsCompositeHelper(PluginMessages.class, PropsUI.getInstance()).
  2. If instantiating reflectively, look up the (Class, PropsUI) constructor via getConstructor(Class.class, PropsUI.class) and invoke it with arguments.
  3. If this is a DI/container scenario, register a factory that supplies messageClass and PropsUI instead of the default constructor.

Example fix

// before
VFSDetailsCompositeHelper helper = new VFSDetailsCompositeHelper();
// after
VFSDetailsCompositeHelper helper = new VFSDetailsCompositeHelper( MyPlugin.class, PropsUI.getInstance() );
Defensive patterns

Strategy: type-guard

Validate before calling

// ensure required args before constructing
if ( messageClass == null || props == null ) throw new IllegalArgumentException( "messageClass and props required" );

Type guard

// check constructor args before use
boolean canConstruct = ( messageClass != null && props != null );

Try / catch

try {
  helper = new VFSDetailsCompositeHelper( messageClass, props );
} catch ( IllegalAccessException e ) {
  throw new IllegalStateException( "Used disabled no-arg constructor", e );
}

Prevention

When it happens

Trigger: Calling `new VFSDetailsCompositeHelper()` with no arguments; reflective instantiation via Class.newInstance() or frameworks that resolve a zero-arg constructor.

Common situations: Copy-pasting construction code from other Kettle composite helpers that have default constructors; dependency-injection or reflection-based UI tooling that assumes a no-arg constructor exists and is usable.

Related errors


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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/core/vfs/connections/ui/dialog/VFSDetailsCompositeHelper.java:50

import org.pentaho.di.ui.core.widget.ComboVar;
import org.pentaho.di.ui.core.widget.PasswordTextVar;
import org.pentaho.di.ui.core.widget.PasswordVisibleTextVar;
import org.pentaho.di.ui.core.widget.TextVar;

import java.util.Set;

/**
 * This class provides common layout logic to all VFSDetailComposites.  You can still roll your own layout but these
 * methods will greatly simplify the process, if you keep within the mold.
 */
public class VFSDetailsCompositeHelper {
  private PropsUI props;
  private int margin;
  private int maxLabelWidth = 0;
  private final Class<?> pkg;

  public VFSDetailsCompositeHelper() throws IllegalAccessException {
    throw new IllegalAccessException( "Must use the messageClass, props constructor" );
  }

  public VFSDetailsCompositeHelper( Class<?> messageClass, PropsUI props ) {
    this.props = props;
    margin = Const.MARGIN;
    pkg = messageClass;
  }

  public PropsUI getProps() {
    return props;
  }

  public int getMaxLabelWidth() {
    return maxLabelWidth;
  }

  public int getMargin() {
    return margin;

View on GitHub (pinned to f3058517a1)