pentaho/pentaho-kettle · error · NotImplementedException

Random access to file in repository is not possible

Error message

Random access to file in repository is not possible

What it means

RepositoryVfsFileContent does not support random access for repo:// files backed by the Pentaho unified repository. getRandomAccessContent always throws NotImplementedException regardless of the requested RandomAccessMode.

Solutions

  1. Read the file sequentially instead: getInputStream()/getOutputStream().
  2. Copy the repository file to a local temp file and use random access there.
  3. Rewrite the consumer to stream the whole content rather than seek.
  4. Use a different VFS scheme (e.g. file://) if random access is mandatory.

Example fix

// before
RandomAccessContent rac = fileObject.getContent().getRandomAccessContent(RandomAccessMode.READ);
// after
try (InputStream in = fileObject.getContent().getInputStream()) {
  File tmp = File.createTempFile("repo", ".bin");
  Files.copy(in, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING);
  // random access on tmp via RandomAccessFile
}
Defensive patterns

Strategy: fallback

Validate before calling

// Avoid API entirely for repo:// files:
boolean unsupported = uri.startsWith("repo://");

Try / catch

try {
  rac = content.getRandomAccessContent(RandomAccessMode.READ);
} catch (NotImplementedException e) {
  // fallback: copy to temp file and use RandomAccessFile
}

Prevention

When it happens

Trigger: Any call to RepositoryVfsFileContent.getRandomAccessContent(mode) — e.g. commons-vfs code paths that open a file via getRandomAccessContent (seek/read/write at offsets).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/de8a98ef4d219f3c. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pentaho-repository-vfs/core/src/main/java/org/pentaho/repositoryvfs/vfs/RepositoryVfsFileContent.java:114

  @Override
  public InputStream getInputStream() throws FileSystemException {
    IUnifiedRepository repo = source.provider.getRepo().getUnderlyingRepository();
    try {
      return new RepositoryFileInputStream( source.path, repo );
    } catch ( FileNotFoundException ex ) {
      return null;
    }
  }

  @Override
  public OutputStream getOutputStream() throws FileSystemException {
    IUnifiedRepository repo = source.provider.getRepo().getUnderlyingRepository();
    return new RepositoryFileOutputStream( source.path, false, false, repo, false );
  }

  @Override
  public RandomAccessContent getRandomAccessContent( RandomAccessMode mode ) throws FileSystemException {
    throw new NotImplementedException( "Random access to file in repository is not possible" );
  }

  @Override
  public OutputStream getOutputStream( boolean bAppend ) throws FileSystemException {
    if ( bAppend ) {
      throw new NotImplementedException( "Append file in repository is not possible" );
    } else {
      return getOutputStream();
    }
  }

  @Override
  public void close() throws FileSystemException {
    throw new NotImplementedException();
  }

  @Override
  public FileContentInfo getContentInfo() throws FileSystemException {

View on GitHub (pinned to f3058517a1)