IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  How do I catch a null pointer exception

    Posted 02/06/03 09:25 PM

    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.


    #webMethods
    #broker
    #Integration-Server-and-ESB
    #Universal-Messaging-Broker


  • 2.  RE: How do I catch a null pointer exception

    Posted 02/06/03 09:52 PM

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


    #webMethods
    #Universal-Messaging-Broker
    #broker
    #Integration-Server-and-ESB


  • 3.  RE: How do I catch a null pointer exception

    Posted 02/06/03 10:50 PM

    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.


    #Universal-Messaging-Broker
    #Integration-Server-and-ESB
    #broker
    #webMethods


  • 4.  RE: How do I catch a null pointer exception

    Posted 02/06/03 11:07 PM

    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


    #webMethods
    #broker
    #Integration-Server-and-ESB
    #Universal-Messaging-Broker