cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CPI: Groovy - java.io.Reader error: Cannot invoke method eachLine() on null object

suwandi_cahyadi
Contributor
5,566

Hi,

I have seen some blog post where people are using java.io.Reader in Groovy to read the body content. For example:

def body = message.getBody(java.io.Reader)<br>body.eachLine { line -><br>	.... Some code here     <br>}

But then if I try the same code, I get the following error message:

javax.script.ScriptException: java.lang.Exception: java.lang.NullPointerException: Cannot invoke method eachLine() on null object@ line 26 in script1.groovy, cause: java.lang.NullPointerException: Cannot invoke method eachLine() on null object

Is there something that I missed?

EDIT: I realized it is error if I used conversion XML to CSV before the script step. If I remove the conversion step this error does not occur.

Thank you.

View Entire Topic
0 Likes

Hi Suwandi,

let us know your problem solved or new problem.

Warm regards, Avinash