{"record":{"id":"d5a2ae0a2fac30df","repo":"pentaho/pentaho-kettle","slug":"error-reading-information-from-input-stream","errorCode":null,"errorMessage":"Error reading information from input stream","messagePattern":"Error reading information from input stream","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java","lineNumber":687,"sourceCode":"\n          // make sure we have an ending slash, otherwise the last part will be ignored\n          //\n          if ( !systemIDwithEndingSlash.endsWith( \"/\" ) && !systemIDwithEndingSlash.endsWith( \"\\\\\" ) ) {\n            systemIDwithEndingSlash = systemIDwithEndingSlash.concat( \"/\" );\n          }\n          doc = db.parse( inputStream, systemIDwithEndingSlash );\n        }\n      } catch ( FileNotFoundException ef ) {\n        throw new KettleXMLException( ef );\n      } finally {\n        if ( inputStream != null ) {\n          inputStream.close();\n        }\n      }\n\n      return doc;\n    } catch ( Exception e ) {\n      throw new KettleXMLException( \"Error reading information from input stream\", e );\n    }\n  }\n\n  public static Document loadXMLFile( File resource ) throws KettleXMLException {\n    try {\n      return loadXMLFile( resource.toURI().toURL() );\n    } catch ( MalformedURLException e ) {\n      throw new KettleXMLException( e );\n    }\n  }\n\n  /**\n   * Load a file into an XML document\n   *\n   * @param resource The resource to load into a document\n   * @return the Document if all went well, null if an error occured!\n   */\n  public static Document loadXMLFile( URL resource ) throws KettleXMLException {","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java#L669-L705","documentation":"loadXMLFile(URL) wraps any exception raised while opening and parsing an XML document from an InputStream (including closing it) into a KettleXMLException with the fixed message \"Error reading information from input stream\". The original cause is attached as the exception cause, so the root reason (malformed XML, connection failure, SAX error) lives in e.getCause().","triggerScenarios":"XMLHandler.loadXMLFile(URL) where the underlying stream throws: unreachable URL, HTTP error responses, malformed/truncated XML causing SAXParseException, DocumentBuilder configuration failure, or IOException during read/close.","commonSituations":"Loading remote plugin descriptors over a flaky network, corrupted or partially downloaded XML files, XML with encoding declared incorrectly, proxy/firewall blocking the URL.","solutions":["Inspect e.getCause() (usually SAXParseException) for the real root problem and its line/column.","Validate the XML file with an XML parser or xmllint before loading.","Check URL reachability (curl the URL) and network/proxy settings.","If the stream is already open in caller code, use loadXMLFile(InputStream) to control the source yourself."],"exampleFix":"// before\ntry { doc = XMLHandler.loadXMLFile(url); }\ncatch (KettleXMLException e) { log.error(e.getMessage()); }\n// after\ntry { doc = XMLHandler.loadXMLFile(url); }\ncatch (KettleXMLException e) {\n  Throwable root = e.getCause();\n  log.error(\"XML load failed: \" + (root instanceof SAXParseException\n    ? \"line \" + ((SAXParseException) root).getLineNumber() + \": \" + root.getMessage()\n    : String.valueOf(root)), e);\n}","handlingStrategy":"try-catch","validationCode":"// Validate before load\ntry (InputStream in = url.openStream()) { /* reachable */ }","typeGuard":null,"tryCatchPattern":"try {\n  doc = XMLHandler.loadXMLFile(url);\n} catch (KettleXMLException e) {\n  Throwable root = e.getCause();\n  log.error(\"XML load from \" + url + \" failed: \" + root, e);\n}","preventionTips":["Always inspect getCause() — the fixed message hides the real error","Validate XML with xmllint in CI before shipping","Check URL/network reachability before blaming the XML"],"tags":["xml","parsing","io"],"backgroundTag":"file-read-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"}