{"record":{"id":"e5211bcdec5b4813","repo":"pentaho/pentaho-kettle","slug":"failed-to-check-isfile-in-setfilename","errorCode":null,"errorMessage":"failed to check isFile in setFilename()","messagePattern":"failed to check isFile in setFilename\\(\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java","lineNumber":251,"sourceCode":"      default:\n        throw new IllegalArgumentException( \"Unexpected SelectionOperation: \" + selectionOperation );\n    }\n\n  }\n\n  void setPath( FileDialogOperation fileDialogOperation, FileObject fileObject, String filePath ) throws KettleException {\n    try {\n      fileDialogOperation.setPath( fileObject.isFile() ? filePath : null  );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setPath()\", fse );\n    }\n  }\n\n  void setFilename( FileDialogOperation fileDialogOperation, FileObject fileObject ) throws KettleException {\n    try {\n      fileDialogOperation.setFilename( fileObject.isFile() ? fileObject.getName().getBaseName() : null );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setFilename()\", fse );\n    }\n  }\n\n  void setStartDir( FileDialogOperation fileDialogOperation, FileObject fileObject, String filePath ) throws KettleException {\n    try {\n      fileDialogOperation.setStartDir( fileObject.isFolder() ? filePath : null );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setStartDir()\", fse );\n    }\n  }\n\n  void setProvider( FileDialogOperation op, FileObject initalFile ) {\n    if ( op.getProviderFilter() == null ) {\n      if ( isConnectedToRepository() ) {\n        op.setProvider( ProviderFilterType.REPOSITORY.toString() );\n      } else if ( isConnectionFile( initalFile ) ) {\n        op.setProvider( ProviderFilterType.VFS.toString() );\n      } else if ( \"hc\".equalsIgnoreCase( initalFile.getURI().getScheme() ) ) {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java#L233-L269","documentation":"setFilename() wraps a KettleException around any FileSystemException thrown while calling FileObject.isFile() on an Apache Commons VFS file object. VFS resolves the file system lazily, so asking isFile() can fail due to network/protocol problems, not just logic errors. The wrapper keeps the FileDialogOperation construction flow simple by converting VFS-specific exceptions into Kettle's standard exception type.","triggerScenarios":"Calling constructFileDialogOperation with a FileObject whose file system cannot be resolved or queried: a non-existent remote file over SFTP/SMB, an unreachable VFS host, invalid credentials, or a malformed VFS URI such as 'sftp://host/wrong/path'.","commonSituations":"Opening the file dialog pointed at a network location that is offline or whose credentials changed; a VFS URI typo; a plugin providing a VFS scheme is missing from the classpath.","solutions":["Verify the file path/URI passed to the dialog is valid and reachable in KettleVFS (e.g. try KettleVFS.getFileObject(path) in a test).","Check network/credentials for the underlying VFS provider (SFTP key, SMB share, repository connection).","Confirm the VFS provider jar for the scheme is on the classpath.","Inspect the wrapped FileSystemException (cause) in the log for the root cause."],"exampleFix":"// before\nFileObject fileObject = KettleVFS.getFileObject( userSuppliedPath );\nop = constructFileDialogOperation( shell, fileObject );\n\n// after\nFileObject fileObject = KettleVFS.getFileObject( userSuppliedPath );\nif ( fileObject != null && fileObject.exists() ) { // resolves URI up-front, fails fast with a clear path\n  op = constructFileDialogOperation( shell, fileObject );\n}","handlingStrategy":"try-catch","validationCode":"FileObject fo = KettleVFS.getFileObject( path );\nif ( fo == null || !fo.exists() ) {\n  throw new IllegalArgumentException( \"Path not resolvable: \" + path );\n}","typeGuard":"boolean isResolvable( FileObject fo ) {\n  try { return fo != null && fo.exists(); } catch ( FileSystemException e ) { return false; }\n}","tryCatchPattern":"try {\n  constructFileDialogOperation( shell, fileObject );\n} catch ( KettleException e ) {\n  if ( e.getCause() instanceof FileSystemException ) {\n    log.warn( \"VFS path not accessible, using default dir\", e );\n    constructFileDialogOperation( shell, null );\n  } else { throw e; }\n}","preventionTips":["Validate VFS URIs with KettleVFS.getFileObject().exists() before opening dialogs","Test network file system connectivity (SFTP/SMB) before UI automation","Keep VFS provider plugins installed for all schemes in use"],"tags":["vfs","file-io","file-dialog","network"],"backgroundTag":"file-read-failed","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"}