{"record":{"id":"96320152d0489f82","repo":"pentaho/pentaho-kettle","slug":"clone-not-supported-for-basefileinputfiles","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/BaseFileInputFiles.java","lineNumber":96,"sourceCode":"  @Injection( name = \"ACCEPT_FILE_FIELD\" )\n  public String acceptingField;\n\n  /** The add filenames to result filenames flag */\n  @Injection( name = \"ADD_FILES_TO_RESULT\" )\n  public boolean isaddresult;\n\n  @Override\n  public Object clone() {\n    try {\n      BaseFileInputFiles cloned = (BaseFileInputFiles) super.clone();\n      cloned.fileName = Arrays.copyOf( fileName, fileName.length );\n      cloned.fileMask = Arrays.copyOf( fileMask, fileMask.length );\n      cloned.excludeFileMask = Arrays.copyOf( excludeFileMask, excludeFileMask.length );\n      cloned.fileRequired = Arrays.copyOf( fileRequired, fileRequired.length );\n      cloned.includeSubFolders = Arrays.copyOf( includeSubFolders, includeSubFolders.length );\n      return cloned;\n    } catch ( CloneNotSupportedException ex ) {\n      throw new IllegalArgumentException( \"Clone not supported for \" + this.getClass().getName() );\n    }\n  }\n\n  public void setFileRequired( String[] fileRequiredin ) {\n    for ( int i = 0; i < fileRequiredin.length; i++ ) {\n      this.fileRequired[i] = getRequiredFilesCode( fileRequiredin[i] );\n    }\n  }\n\n  public void setIncludeSubFolders( String[] includeSubFoldersin ) {\n    for ( int i = 0; i < includeSubFoldersin.length; i++ ) {\n      this.includeSubFolders[i] = getRequiredFilesCode( includeSubFoldersin[i] );\n    }\n  }\n\n  public static String getRequiredFilesCode( String tt ) {\n    if ( tt == null ) {\n      return RequiredFilesCode[0];","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputFiles.java#L78-L114","documentation":"BaseFileInputFiles.clone() performs a field-by-field shallow copy plus Arrays.copyOf for its String[]/boolean[] arrays, and wraps CloneNotSupportedException in an IllegalArgumentException when the concrete class is not Cloneable. Since the clone method itself is implemented here, the failure means the runtime class lacks the Cloneable marker interface.","triggerScenarios":"Cloning a BaseFileInputFiles instance (file lists of a file-input step) whose concrete class does not implement Cloneable, typically during transformation copy or step metadata duplication.","commonSituations":"Custom file-input plugins extending BaseFileInputFiles without Cloneable; class-hierarchy changes across Pentaho/Kettle versions breaking metadata copy at design time or run time.","solutions":["Make the concrete class named in the message implement Cloneable.","Rebuild/redeploy the plugin so the corrected class is on the classpath.","If cloning persists, duplicate the object manually (new instance + Arrays.copyOf of each array)."],"exampleFix":"// before\npublic class MyFiles extends BaseFileInputFiles { }\n// after\npublic class MyFiles extends BaseFileInputFiles implements Cloneable { }","handlingStrategy":"try-catch","validationCode":"if (!Cloneable.class.isAssignableFrom(files.getClass())) {\n  throw new IllegalStateException(files.getClass().getName() + \" must implement Cloneable\");\n}","typeGuard":"boolean isCloneable(Object o) { return o instanceof Cloneable; }","tryCatchPattern":"try {\n  BaseFileInputFiles copy = (BaseFileInputFiles) files.clone();\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Add Cloneable to \" + e.getMessage(), e);\n}","preventionTips":["Declare Cloneable on all BaseFileInputFiles subclasses.","Cover metadata clone paths with automated tests.","Avoid customizing clone() without keeping the Cloneable marker."],"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"}