{"record":{"id":"de8a98ef4d219f3c","repo":"pentaho/pentaho-kettle","slug":"random-access-to-file-in-repository-is-not-possible","errorCode":null,"errorMessage":"Random access to file in repository is not possible","messagePattern":"Random access to file in repository is not possible","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"plugins/pentaho-repository-vfs/core/src/main/java/org/pentaho/repositoryvfs/vfs/RepositoryVfsFileContent.java","lineNumber":114,"sourceCode":"  @Override\n  public InputStream getInputStream() throws FileSystemException {\n    IUnifiedRepository repo = source.provider.getRepo().getUnderlyingRepository();\n    try {\n      return new RepositoryFileInputStream( source.path, repo );\n    } catch ( FileNotFoundException ex ) {\n      return null;\n    }\n  }\n\n  @Override\n  public OutputStream getOutputStream() throws FileSystemException {\n    IUnifiedRepository repo = source.provider.getRepo().getUnderlyingRepository();\n    return new RepositoryFileOutputStream( source.path, false, false, repo, false );\n  }\n\n  @Override\n  public RandomAccessContent getRandomAccessContent( RandomAccessMode mode ) throws FileSystemException {\n    throw new NotImplementedException( \"Random access to file in repository is not possible\" );\n  }\n\n  @Override\n  public OutputStream getOutputStream( boolean bAppend ) throws FileSystemException {\n    if ( bAppend ) {\n      throw new NotImplementedException( \"Append file in repository is not possible\" );\n    } else {\n      return getOutputStream();\n    }\n  }\n\n  @Override\n  public void close() throws FileSystemException {\n    throw new NotImplementedException();\n  }\n\n  @Override\n  public FileContentInfo getContentInfo() throws FileSystemException {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pentaho-repository-vfs/core/src/main/java/org/pentaho/repositoryvfs/vfs/RepositoryVfsFileContent.java#L96-L132","documentation":"RepositoryVfsFileContent does not support random access for repo:// files backed by the Pentaho unified repository. getRandomAccessContent always throws NotImplementedException regardless of the requested RandomAccessMode.","triggerScenarios":"Any call to RepositoryVfsFileContent.getRandomAccessContent(mode) — e.g. commons-vfs code paths that open a file via getRandomAccessContent (seek/read/write at offsets).","commonSituations":"Libraries that require RandomAccessFile-style access (zip readers, binary parsers) pointed at repo:// URIs; code ported from local-file VFS to repository VFS without changing its access pattern.","solutions":["Read the file sequentially instead: getInputStream()/getOutputStream().","Copy the repository file to a local temp file and use random access there.","Rewrite the consumer to stream the whole content rather than seek.","Use a different VFS scheme (e.g. file://) if random access is mandatory."],"exampleFix":"// before\nRandomAccessContent rac = fileObject.getContent().getRandomAccessContent(RandomAccessMode.READ);\n// after\ntry (InputStream in = fileObject.getContent().getInputStream()) {\n  File tmp = File.createTempFile(\"repo\", \".bin\");\n  Files.copy(in, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING);\n  // random access on tmp via RandomAccessFile\n}","handlingStrategy":"fallback","validationCode":"// Avoid API entirely for repo:// files:\nboolean unsupported = uri.startsWith(\"repo://\");","typeGuard":null,"tryCatchPattern":"try {\n  rac = content.getRandomAccessContent(RandomAccessMode.READ);\n} catch (NotImplementedException e) {\n  // fallback: copy to temp file and use RandomAccessFile\n}","preventionTips":["Never use random-access readers/parsers directly on repo:// files.","Copy repository content to a local temp file when random access is required.","Design consumers around streaming (InputStream/OutputStream) access."],"tags":["vfs","repository","random-access","unsupported-operation"],"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"}