{"record":{"id":"04968498888b6c71","repo":"pentaho/pentaho-kettle","slug":"clone-not-supported-for-basefileinputadditionalfield","errorCode":null,"errorMessage":"Clone not supported for ","messagePattern":"Clone not supported for ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputAdditionalField.java","lineNumber":48,"sourceCode":"  @Injection( name = \"FILE_PATH_FIELDNAME\" )\n  public String pathField;\n  @Injection( name = \"FILE_SIZE_FIELDNAME\" )\n  public String sizeField;\n  @Injection( name = \"FILE_HIDDEN_FIELDNAME\" )\n  public String hiddenField;\n  @Injection( name = \"FILE_LAST_MODIFICATION_FIELDNAME\" )\n  public String lastModificationField;\n  @Injection( name = \"FILE_URI_FIELDNAME\" )\n  public String uriField;\n  @Injection( name = \"FILE_ROOT_URI_FIELDNAME\" )\n  public String rootUriField;\n\n  @Override\n  public Object clone() {\n    try {\n      return super.clone();\n    } catch ( CloneNotSupportedException ex ) {\n      throw new IllegalArgumentException( \"Clone not supported for \" + this.getClass().getName() );\n    }\n  }\n\n  /**\n   * Set null for all empty field values to be able to fast check during step processing. Need to be executed once\n   * before processing.\n   */\n  public void normalize() {\n    if ( StringUtils.isBlank( shortFilenameField ) ) {\n      shortFilenameField = null;\n    }\n    if ( StringUtils.isBlank( extensionField ) ) {\n      extensionField = null;\n    }\n    if ( StringUtils.isBlank( pathField ) ) {\n      pathField = null;\n    }\n    if ( StringUtils.isBlank( sizeField ) ) {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputAdditionalField.java#L30-L66","documentation":"BaseFileInputAdditionalField.clone() delegates to Object.clone(), which requires the runtime class to implement Cloneable; otherwise CloneNotSupportedException is wrapped in an IllegalArgumentException naming the class. File input step metadata is cloned when transformations are copied or executed, so subclasses must be Cloneable.","triggerScenarios":"Cloning a BaseFileInputAdditionalField instance whose concrete class does not implement Cloneable, e.g. during transformation metadata duplication or step init.","commonSituations":"Custom extensions of BaseFileInputAdditionalField missing the Cloneable marker; plugin upgrades where the base class hierarchy changed; Kettle copying step metadata at run time.","solutions":["Add 'implements Cloneable' to the concrete subclass shown in the message.","Re-check after Kettle version upgrades that custom metadata classes still satisfy Cloneable.","Replace clone() usage with an explicit copy constructor if cloning cannot be fixed."],"exampleFix":"// before\npublic class MyAdditionalFields extends BaseFileInputAdditionalField { }\n// after\npublic class MyAdditionalFields extends BaseFileInputAdditionalField implements Cloneable { }","handlingStrategy":"try-catch","validationCode":"if (!Cloneable.class.isAssignableFrom(additionalField.getClass())) {\n  throw new IllegalStateException(additionalField.getClass().getName() + \" must implement Cloneable\");\n}","typeGuard":"boolean isCloneable(Object o) { return o instanceof Cloneable; }","tryCatchPattern":"try {\n  Object copy = additionalField.clone();\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Implement Cloneable on \" + e.getMessage(), e);\n}","preventionTips":["Ensure custom subclasses of BaseFileInputAdditionalField implement Cloneable.","Test transformation copy/duplicate flows in plugin CI.","Use explicit field-copy methods instead of clone when possible."],"tags":["java","clone","metadata"],"backgroundTag":"unsupported-operation","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"}