How do I catch a null pointer exception

Platform: webMethods Enterprise Server, v4.6

We are enclose our integrations around try-catch blocks that you can build with Enterprise Integrator. These catch AdapterException. Within such a try-catch block, I executed the statement

s.indexOf(“abc”)

where s = null. This threw a null pointer exception. It seems that the try-catch block did not catch this exception, and I’m having trouble figuring out how to catch it.

I would use a Custom step and put the call inside a “real” try-catch.

This probably isn’t what you were after but perhaps you could test for null before working with s, thereby avoiding the need to catch the exception at all.

 
if(s != null) 
  idx=s.indexOf("abc") 
else 
  idx=-1

Not trying to be a smart-aleck on this. We just sometimes overlook the obvious.

Thanks for the suggestions.

I wanted to catch all catchable errors that may arise. I thought the Enterprise Server try-catch blocks handled all exceptions, but the above is a counter-example.

So, my revised question: What exceptions don’t the Enterprise Server try-catch blocks catch, and how can I catch them (across steps in an integration)?

Thanks in advance for any help you can provide.

Regards,

Mike