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,570

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
shivaprasad1
Participant
0 Likes

Hi Suwandi,

Is there any way that you have figured out the issue?

I am also facing the same issue

Please let me know if you find any solution

Thanks

Shiva