{"record":{"id":"16f4204fc4cd2c36","repo":"pentaho/pentaho-kettle","slug":"kettleexception-e","errorCode":null,"errorMessage":"KettleException( e )","messagePattern":"KettleException\\( e \\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java","lineNumber":45,"sourceCode":"import org.pentaho.di.core.spreadsheet.KSheet;\nimport org.pentaho.di.core.spreadsheet.KWorkbook;\nimport org.pentaho.di.core.vfs.KettleVFS;\n\npublic class OdfWorkbook implements KWorkbook {\n\n  private String filename;\n  private String encoding;\n  private OdfDocument document;\n  private Map<String, OdfSheet> openSheetsMap = new HashMap<String, OdfSheet>();\n\n  public OdfWorkbook( Bowl bowl, String filename, String encoding ) throws KettleException {\n    this.filename = filename;\n    this.encoding = encoding;\n\n    try {\n      document = OdfSpreadsheetDocument.loadDocument( KettleVFS.getInstance( bowl ).getInputStream( filename ) );\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    }\n  }\n\n  public OdfWorkbook( InputStream inputStream, String encoding ) throws KettleException {\n    this.encoding = encoding;\n\n    try {\n      document = OdfSpreadsheetDocument.loadDocument( inputStream );\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    }\n  }\n\n  public void close() {\n    if ( document != null ) {\n      document.close();\n    }\n  }","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java#L27-L63","documentation":"The OdfWorkbook(String filename, ...) constructor loads an ODF spreadsheet document through KettleVFS and wraps any failure (missing file, I/O error, invalid ODF package) in a KettleException. It is thrown so that Kettle's step framework receives a uniform checked exception with the original cause attached.","triggerScenarios":"Constructing OdfWorkbook with a filename when OdfSpreadsheetDocument.loadDocument() or KettleVFS.getInputStream() throws any Exception: file not found, unreadable stream, or content that is not a valid ODF spreadsheet.","commonSituations":"Typo in the spreadsheet path or wrong VFS scheme; file moved/deleted between configuration and execution; feeding an .xls/.xlsx file to the ODS-based reader; a corrupted download.","solutions":["Verify the file exists at the exact filename/URI and is readable by the Kettle process.","Confirm the file is actually an ODF spreadsheet (.ods); use the POI-based workbook for .xls/.xlsx.","Open and re-save the file in LibreOffice to repair a corrupted package.","Inspect e.getCause() (e.g. FileNotFoundException vs ZipException) to pinpoint whether it is a path or format problem."],"exampleFix":"// before\nWorkbook wb = new OdfWorkbook(bowl, filename, encoding);\n// after\nFile f = new File(filename);\nif (!f.exists() || !f.canRead()) throw new KettleException(\"Cannot read file: \" + filename);\nWorkbook wb = new OdfWorkbook(bowl, filename, encoding);","handlingStrategy":"validation","validationCode":"File f = new File(filename); if (!f.exists() || !f.canRead()) throw new KettleException(\"Missing/unreadable ODS file: \" + filename);","typeGuard":null,"tryCatchPattern":"try { wb = new OdfWorkbook(bowl, filename, encoding); } catch (KettleException e) { throw new KettleException(\"Failed to open ODS '\" + filename + \"'\", e); }","preventionTips":["Verify file existence/permissions before opening","Confirm the extension matches the actual format (use the POI reader for xls/xlsx)","Use stable VFS URIs and check the file is not moved between steps","Log e.getCause() to distinguish path vs format errors"],"tags":["odf","workbook-open","kettle-exception","file-load"],"backgroundTag":"file-open-failed","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"}