pentaho/pentaho-kettle · error · UnsupportedOperationException

Read-only data structure

Error message

Read-only data structure

What it means

DelegatingSharedObjectsIO exposes a read-only view over shared objects. Its delete() method always throws UnsupportedOperationException('Read-only data structure') — mutation is not supported by this wrapper by design. Tests and callers use this to assert that deletion is disabled.

Solutions

  1. Obtain a writable SharedObjectsIO implementation (e.g. file- or DB-backed) for mutation operations
  2. Guard mutation calls with a capability check and skip or surface a proper user-facing message
  3. Copy the data into a writable structure before modifying

Example fix

// before
sharedObjectsIO.delete( type, name ); // throws
// after
if ( sharedObjectsIO instanceof DelegatingSharedObjectsIO ) {
  // read-only view: skip mutation or use the backing writable IO
} else {
  sharedObjectsIO.delete( type, name );
}
Defensive patterns

Strategy: type-guard

Validate before calling

if ( io instanceof DelegatingSharedObjectsIO ) {
  throw new IllegalStateException( "This view is read-only; use a writable IO" );
}

Type guard

boolean isReadOnly = io instanceof DelegatingSharedObjectsIO;

Try / catch

try {
  io.delete( type, name );
} catch ( UnsupportedOperationException e ) {
  log.warn( "Shared objects view is read-only; deletion skipped" );
}

Prevention

When it happens

Trigger: Calling delete(type, name) on a DelegatingSharedObjectsIO constructed in read-only mode.

Common situations: Code that mutates shared objects uniformly without knowing the underlying IO is read-only; refactorings that replace a writable IO with a delegating read-only one; tests like testDeleteDisabled exercising the contract.

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/cd53980f8605ad1b. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/shared/DelegatingSharedObjectsIO.java:77

      }
    }
    return retMap;
  }

  @Override
  public Node getSharedObject( String type, String name ) throws KettleException {
    for ( SharedObjectsIO store : stores ) {
      Node node = store.getSharedObject( type, name );
      if ( node != null ) {
        return node;
      }
    }
    return null;
  }

  @Override
  public void delete( String type, String name ) throws KettleException {
    throw new UnsupportedOperationException( "Read-only data structure" );
  }

  @Override
  public void clear( String type ) throws KettleException {
    throw new UnsupportedOperationException( "Read-only data structure" );
  }

  @Override
  public void saveSharedObject( String type, String name, Node node ) throws KettleException {
    throw new UnsupportedOperationException( "Read-only data structure" );
  }

  @Override
  public void clearCache() {
    for ( SharedObjectsIO store : stores ) {
      store.clearCache();
    }
  }

View on GitHub (pinned to f3058517a1)