Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-18332

XML Output step: Null pointer exception when processing fields with null values

    XMLWordPrintable

    Details

    • Story Points:
      1
    • PDI Sub-component:
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.
    • Sprint Team:
      Tatooine (Maint)

      Description

      Description:

      The XML Output step does not handle null values from the incoming stream. If a field contains null data, the step will error with a null pointer exception.

      The exception will occur if Omit null values from XML output is checked or unchecked. The exception will also occur if a default value is supplied for NULL fields.

      This step fails in version 8.0 and 7.1. However, this works correctly in version 6.1. where the following XML is generated

      <?xml version="1.0" encoding="UTF-8"?>
      <ROWS>
       <ROW ROWNUMBER=" 1" Value="null"> </ROW>
       <ROW ROWNUMBER=" 2" Value="null"> </ROW>
      </ROWS>
      

      Steps to reproduce:

      1. Import the attached transformation

      [^XMLOutputWithNullVals.xml]

      2. Change the output file to a valid location
      3. Run the transformation

      Current behavior:

      The following exception is generated

      2018/04/23 11:56:51 - Data Grid.0 - Finished processing (I=0, O=0, R=0, W=2, U=0, E=0)
      2018/04/23 11:56:51 - XML Output.0 - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : Unexpected error
      2018/04/23 11:56:51 - XML Output.0 - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : org.pentaho.di.core.exception.KettleException: 
      2018/04/23 11:56:51 - XML Output.0 - Error writing XML row :java.lang.NullPointerException
      2018/04/23 11:56:51 - XML Output.0 - Row: [1], [null]
      2018/04/23 11:56:51 - XML Output.0 -  at java.lang.Thread.run (Thread.java:748)
      2018/04/23 11:56:51 - XML Output.0 -  at org.pentaho.di.trans.step.RunThread.run (RunThread.java:62)
      2018/04/23 11:56:51 - XML Output.0 -  at org.pentaho.di.trans.steps.xmloutput.XMLOutput.processRow (XMLOutput.java:117)
      2018/04/23 11:56:51 - XML Output.0 -  at org.pentaho.di.trans.steps.xmloutput.XMLOutput.writeRowToFile (XMLOutput.java:185)
      2018/04/23 11:56:51 - XML Output.0 -  at org.pentaho.di.trans.steps.xmloutput.XMLOutput.writeRowAttributes (XMLOutput.java:234)
      2018/04/23 11:56:51 - XML Output.0 -  at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute (BaseNsStreamWriter.java:228)
      2018/04/23 11:56:51 - XML Output.0 -  at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr (BaseNsStreamWriter.java:493)
      2018/04/23 11:56:51 - XML Output.0 - 
      2018/04/23 11:56:51 - XML Output.0 - 	at org.pentaho.di.trans.steps.xmloutput.XMLOutput.writeRowToFile(XMLOutput.java:216)
      2018/04/23 11:56:51 - XML Output.0 - 	at org.pentaho.di.trans.steps.xmloutput.XMLOutput.processRow(XMLOutput.java:117)
      2018/04/23 11:56:51 - XML Output.0 - 	at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
      2018/04/23 11:56:51 - XML Output.0 - 	at java.lang.Thread.run(Thread.java:748)
      2018/04/23 11:56:51 - XML Output.0 - Caused by: java.lang.NullPointerException
      2018/04/23 11:56:51 - XML Output.0 - 	at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr(BaseNsStreamWriter.java:493)
      2018/04/23 11:56:51 - XML Output.0 - 	at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute(BaseNsStreamWriter.java:228)
      2018/04/23 11:56:51 - XML Output.0 - 	at org.pentaho.di.trans.steps.xmloutput.XMLOutput.writeRowAttributes(XMLOutput.java:234)
      2018/04/23 11:56:51 - XML Output.0 - 	at org.pentaho.di.trans.steps.xmloutput.XMLOutput.writeRowToFile(XMLOutput.java:185)
      2018/04/23 11:56:51 - XML Output.0 - 	... 3 more
      

      Expected behavior:

      The transformation should generate the following XML output

      <?xml version="1.0" encoding="UTF-8"?>
      <ROWS>
       <ROW ROWNUMBER=" 1" Value="null"> </ROW>
       <ROW ROWNUMBER=" 2" Value="null"> </ROW>
      </ROWS>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vasco.marques Vasco Marques
              Reporter:
              chokai Mariusz Karpowicz
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: