Search code examples
filenullpointerexceptionswitch-statementpentahopreview

Why does preview option throw an error when using switch / step with a particular excel file?


I have an excel file which I want to filter using Switch / case. The transformation named error:

The Transformation

returns:

2018/03/01 11:48:00 - Spoon - Using legacy execution engine
2018/03/01 11:48:00 - Spoon - Transformation opened.
2018/03/01 11:48:00 - Spoon - Launching transformation [error]...
2018/03/01 11:48:00 - Spoon - Started the transformation execution.
2018/03/01 11:48:00 - error - Dispatching started for transformation [error]
2018/03/01 11:48:00 - Microsoft Excel Input.0 - Finished processing (I=108, O=0, R=0, W=108, U=0, E=0)
2018/03/01 11:48:00 - Switch / case.0 - Finished processing (I=0, O=0, R=108, W=108, U=0, E=0)
2018/03/01 11:48:00 - Dummy (do nothing).0 - Finished processing (I=0, O=0, R=108, W=108, U=0, E=0)
2018/03/01 11:48:00 - Spoon - The transformation has finished!!

when run. However it throws the error:

The Error

2018/03/01 11:49:07 - error - Dispatching started for transformation [error]
2018/03/01 11:49:07 - Switch / case.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/03/01 11:49:07 - Switch / case.0 - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : java.lang.NullPointerException
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.BaseStep.safeModeChecking(BaseStep.java:2129)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.BaseStep.handleGetRow(BaseStep.java:1942)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.BaseStep.access$100(BaseStep.java:147)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.BaseStep$DefaultRowHandler.getRow(BaseStep.java:4180)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.BaseStep.getRow(BaseStep.java:1797)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.steps.switchcase.SwitchCase.processRow(SwitchCase.java:65)
2018/03/01 11:49:07 - Switch / case.0 -     at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2018/03/01 11:49:07 - Switch / case.0 -     at java.lang.Thread.run(Thread.java:748)
2018/03/01 11:49:07 - Switch / case.0 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)
2018/03/01 11:49:07 - Microsoft Excel Input.0 - Finished processing (I=11, O=0, R=0, W=10, U=0, E=0)
2018/03/01 11:49:07 - error - Transformation detected one or more steps with errors.
2018/03/01 11:49:07 - error - Transformation is killing the other steps!
2018/03/01 11:49:07 - error - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : Errors detected!
2018/03/01 11:49:07 - Spoon - The transformation has finished!!
2018/03/01 11:49:07 - error - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : Errors detected!
2018/03/01 11:49:07 - error - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : Errors detected!

when Right-Click/Preview... is used on any of the steps and I am unable to preview the data in any of the steps that comes after Switch / case. While Preview data tab under Execution Results beneath is able to preview the data in all steps.

I tried to reproduce the error with a Generate Rows step or using another file but I was unsuccessful, so this seems to suggest that Switch / case dislikes something about my particular file which I couldn't determine at this time.

Why is this happening? How can I prevent it from happening?


Solution

  • The issue was that I had an empty-named field in the Microsoft Excel Input step. I renamed it to actually contain a non-empty string, and the issue has resolved.