{"record":{"id":"cd53980f8605ad1b","repo":"pentaho/pentaho-kettle","slug":"read-only-data-structure","errorCode":null,"errorMessage":"Read-only data structure","messagePattern":"Read-only data structure","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/shared/DelegatingSharedObjectsIO.java","lineNumber":77,"sourceCode":"      }\n    }\n    return retMap;\n  }\n\n  @Override\n  public Node getSharedObject( String type, String name ) throws KettleException {\n    for ( SharedObjectsIO store : stores ) {\n      Node node = store.getSharedObject( type, name );\n      if ( node != null ) {\n        return node;\n      }\n    }\n    return null;\n  }\n\n  @Override\n  public void delete( String type, String name ) throws KettleException {\n    throw new UnsupportedOperationException( \"Read-only data structure\" );\n  }\n\n  @Override\n  public void clear( String type ) throws KettleException {\n    throw new UnsupportedOperationException( \"Read-only data structure\" );\n  }\n\n  @Override\n  public void saveSharedObject( String type, String name, Node node ) throws KettleException {\n    throw new UnsupportedOperationException( \"Read-only data structure\" );\n  }\n\n  @Override\n  public void clearCache() {\n    for ( SharedObjectsIO store : stores ) {\n      store.clearCache();\n    }\n  }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/shared/DelegatingSharedObjectsIO.java#L59-L95","documentation":"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.","triggerScenarios":"Calling delete(type, name) on a DelegatingSharedObjectsIO constructed in read-only mode.","commonSituations":"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.","solutions":["Obtain a writable SharedObjectsIO implementation (e.g. file- or DB-backed) for mutation operations","Guard mutation calls with a capability check and skip or surface a proper user-facing message","Copy the data into a writable structure before modifying"],"exampleFix":"// before\nsharedObjectsIO.delete( type, name ); // throws\n// after\nif ( sharedObjectsIO instanceof DelegatingSharedObjectsIO ) {\n  // read-only view: skip mutation or use the backing writable IO\n} else {\n  sharedObjectsIO.delete( type, name );\n}","handlingStrategy":"type-guard","validationCode":"if ( io instanceof DelegatingSharedObjectsIO ) {\n  throw new IllegalStateException( \"This view is read-only; use a writable IO\" );\n}","typeGuard":"boolean isReadOnly = io instanceof DelegatingSharedObjectsIO;","tryCatchPattern":"try {\n  io.delete( type, name );\n} catch ( UnsupportedOperationException e ) {\n  log.warn( \"Shared objects view is read-only; deletion skipped\" );\n}","preventionTips":["Expose mutation only through writable IO implementations","Check wrapper type before mutating shared objects","Document read-only semantics in APIs returning DelegatingSharedObjectsIO"],"tags":["unsupported-operation","read-only","shared-objects"],"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"}