{"record":{"id":"8133753e05503c42","repo":"pentaho/pentaho-kettle","slug":"failed-to-check-isfile-in-setpath","errorCode":null,"errorMessage":"failed to check isFile in setPath()","messagePattern":"failed to check isFile in setPath\\(\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java","lineNumber":243,"sourceCode":"      case SAVE:\n        return new FileDialogOperation( bowl, FileDialogOperation.SAVE, FileDialogOperation.ORIGIN_SPOON );\n      case SAVE_TO:\n        return new FileDialogOperation( bowl, FileDialogOperation.SAVE_TO, FileDialogOperation.ORIGIN_SPOON );\n      case SAVE_TO_FILE_FOLDER:\n        return new FileDialogOperation( bowl, FileDialogOperation.SAVE_TO_FILE_FOLDER, FileDialogOperation.ORIGIN_SPOON );\n      case OPEN:\n        return new FileDialogOperation( bowl, FileDialogOperation.OPEN, FileDialogOperation.ORIGIN_SPOON );\n      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  }","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java#L225-L261","documentation":"SelectionAdapterFileDialog.setPath checks fileObject.isFile() to decide whether to set the path on the FileDialogOperation. If the Apache VFS call throws FileSystemException (e.g. VFS cannot stat the file), it is wrapped in a KettleException 'failed to check isFile in setPath()'.","triggerScenarios":"Selecting a file in a file dialog backed by a VFS FileObject whose isFile() probe fails — network drive disconnected, inaccessible SFTP/HTTP resource, stale file handle, or unsupported/invalid VFS URI.","commonSituations":"Browsing files over SFTP/S3/HTTP VFS and the remote becomes unreachable; file deleted between listing and selection; wrong VFS scheme (e.g. malformed sftp:// URL) producing an unresolvable FileObject.","solutions":["Read the wrapped FileSystemException cause to identify the VFS resolution problem and fix the URI/credentials.","Verify the remote resource (network share/SFTP host) is reachable and credentials are valid before browsing.","Re-resolve the FileObject freshly instead of reusing a cached one from an earlier listing.","Catch the KettleException in the caller (constructFileDialogOperation path) and fall back to setting the raw filePath without the isFile check."],"exampleFix":"// before\nfileDialogOperation.setPath( fileObject.isFile() ? filePath : null );\n// after\ntry {\n  fileDialogOperation.setPath( fileObject.isFile() ? filePath : filePath );\n} catch ( FileSystemException fse ) {\n  fileDialogOperation.setPath( filePath );\n}","handlingStrategy":"try-catch","validationCode":"// ensure the VFS object can be resolved before isFile checks\nboolean resolvable;\ntry {\n  resolvable = fileObject.getContent() != null;\n} catch ( FileSystemException e ) {\n  resolvable = false;\n}","typeGuard":"boolean fileObjectReadable( FileObject fo ) {\n  try {\n    return fo != null && fo.getType().hasChildren() != null;\n  } catch ( FileSystemException e ) {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  setPath( op, fileObject, filePath );\n} catch ( KettleException e ) {\n  logError( \"VFS isFile check failed; defaulting path\", e );\n  op.setPath( filePath );\n}","preventionTips":["Verify remote VFS resources (SFTP/HTTP/S3) are reachable and credentials valid before browsing.","Re-resolve FileObjects freshly rather than caching them across operations.","Validate VFS URIs (scheme, host, path) before passing them to file dialogs."],"tags":["vfs","file-dialog","network-filesystem","java"],"backgroundTag":"file-not-found","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"}