{"record":{"id":"10d538608ea56e2c","repo":"pentaho/pentaho-kettle","slug":"e-tostring-getxmldata","errorCode":null,"errorMessage":"e.toString()","messagePattern":"e\\.toString\\(\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java","lineNumber":882,"sourceCode":"\n      if ( irow == null ) {\n        data.previousRow = outputRowData;\n      } else {\n        // clone to previously allocated array to make sure next step doesn't\n        // change it in between...\n        System.arraycopy( outputRowData, 0, this.prevRow, 0, outputRowData.length );\n        // Pick up everything else that needs a real deep clone\n        data.previousRow = irow.cloneRow( outputRowData, this.prevRow );\n      }\n    } catch ( Exception e ) {\n      if ( getStepMeta().isDoingErrorHandling() ) {\n        // Simply add this row to the error row\n        putError( data.outputRowMeta, outputRowData, 1, e.toString(), null, \"GetXMLData001\" );\n        data.errorInRowButContinue = true;\n        return null;\n      } else {\n        logError( e.toString() );\n        throw new KettleException( e.toString() );\n      }\n    }\n    return outputRowData;\n  }\n\n  public String substituteToken( String aString, Object[] outputRowData ) {\n    if ( aString == null ) {\n      return null;\n    }\n\n    StringBuilder buffer = new StringBuilder();\n\n    String rest = aString;\n\n    // search for closing string\n    int i = rest.indexOf( data.tokenStart );\n    while ( i > -1 ) {\n      int j = rest.indexOf( data.tokenEnd, i + data.tokenStart.length() );","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java#L864-L900","documentation":"In processPutRow, when an exception occurs while building an output row and step error handling is enabled, the row is routed to the error stream with e.toString() as the error description (code GetXMLData001). Without error handling enabled, the same message is logged and rethrown as a KettleException, failing the transformation.","triggerScenarios":"processPutRow catch block: field value conversion/extraction fails, e.g. XPath returns incompatible content, a field format (date/number mask) fails to parse, or substituteToken/field mapping throws.","commonSituations":"Date/number conversion masks that do not match actual data ('Format' tab), XPath fields resolving to nodes with unexpected content, nulls where a type conversion is expected.","solutions":["Read e.toString() from the error stream / log to identify which field failed conversion.","Correct the field's Format/Length/Precision in the Fields tab to match the data (e.g. set proper date mask).","Enable step error handling (putError path) to redirect bad rows to an error stream instead of failing.","Adjust the Loop XPath or field XPath so it extracts the expected element/text values."],"exampleFix":"// before: number format mismatch\nfield.setFormat( \"#,###.00\" ); // data is \"1.234,56\" (European)\n// after\nfield.setFormat( \"#.##0,00\" ); // match the locale of the source data","handlingStrategy":"try-catch","validationCode":"// Java API: test field extraction on a sample document before the run\nNode n = XPathFactory.newInstance().newXPath().evaluate( xpathExpr, doc, XPathConstants.NODE );\nif ( n == null ) { throw new IllegalStateException( \"XPath returns nothing: \" + xpathExpr ); }","typeGuard":null,"tryCatchPattern":"stepMeta.setStepErrorHandling( errorHandling ); // send rows to error stream; read putError code \"GetXMLData001\" + e.toString() to find the bad field","preventionTips":["Preview rows in Spoon and verify each field's Format mask against real data.","Use correct locale-aware date/number patterns (yyyy vs YYYY).","Enable step error handling in production to tolerate row-level conversion failures."],"tags":["pentaho-kettle","xml","type-conversion","getxmldata"],"backgroundTag":"invalid-argument-format","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"}