{"record":{"id":"72744e561770b93c","repo":"pentaho/pentaho-kettle","slug":"use-getconverter","errorCode":null,"errorMessage":"Use getConverter","messagePattern":"Use getConverter","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"plugins/repo-vfs/repo-vfs-pur/src/main/java/org/pentaho/di/plugins/repofvs/pur/converter/ContentConverterHandler.java","lineNumber":51,"sourceCode":"    this.transConverter = new MetaConverter<>( objId -> repository.loadTransformation( objId, null ) );\n    this.jobConverter = new MetaConverter<>( objId -> repository.loadJob( objId, null ) );\n  }\n\n  @Override\n  public Converter getConverter( String extension ) {\n    if ( extension == null ) {\n      return simpleConverter;\n    }\n    return switch ( extension.toLowerCase() ) {\n      case Const.STRING_JOB_DEFAULT_EXT -> jobConverter;\n      case Const.STRING_TRANS_DEFAULT_EXT -> transConverter;\n      default -> simpleConverter;\n    };\n  }\n\n  @Override\n  public Map<String, Converter> getConverters() {\n    throw new UnsupportedOperationException( \"Use getConverter\" );\n  }\n\n  @Override\n  public void addConverter( String extension, Converter converter ) {\n    throw new UnsupportedOperationException( \"Cannot add converters\" );\n  }\n\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":61,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/repo-vfs/repo-vfs-pur/src/main/java/org/pentaho/di/plugins/repofvs/pur/converter/ContentConverterHandler.java#L33-L61","documentation":"ContentConverterHandler deliberately rejects the bulk getConverters() API inherited from its interface/parent. Converter lookup must go through getConverter(String), so the plural accessor is intentionally unimplemented to force callers onto the single-converter path.","triggerScenarios":"Calling getConverters() on a ContentConverterHandler instance, typically via framework code (e.g. Apache VFS content-handling or repository file resolution) that iterates all registered converters.","commonSituations":"Upgrading Pentaho/VFS versions where calling code uses the old bulk-converter API; custom plugins enumerating converters; reflection-based code inspecting the handler.","solutions":["Replace the getConverters() call with getConverter(String extension) for the specific extension you need","If you must enumerate, query the individual extensions you know (ktr, kjb, etc.) one by one via getConverter","Update custom calling code to the single-converter API supported by this handler"],"exampleFix":"// before\nMap<String, Converter> all = handler.getConverters();\n// after\nConverter conv = handler.getConverter( \"ktr\" );","handlingStrategy":"try-catch","validationCode":"// Prefer the supported API; avoid the bulk accessor\nConverter conv = handler.getConverter( extension );\nboolean bulkUsed = false; // never call getConverters()","typeGuard":"boolean supportsBulkListing( ContentConverterHandler h ) {\n  return false; // contract: bulk listing is intentionally unsupported\n}","tryCatchPattern":"try {\n  Map<String, Converter> m = handler.getConverters();\n} catch ( UnsupportedOperationException e ) {\n  Converter c = handler.getConverter( extension ); // fall back to single lookup\n}","preventionTips":["Always use getConverter(extension) instead of getConverters()","Do not write code that enumerates converters from this handler","Check UnsupportedOperationException contracts before calling interface methods"],"tags":["unsupported-operation","api-misuse","vfs"],"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"}