JPOS 1.6 null pointer exception

View: New views
2 Messages — Rating Filter:   Alert me  

JPOS 1.6 null pointer exception

by santhoshvee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I was trying to upgrade my JPOS to V1.6.4. However, while running a sample code mentioned in the Jpos Guide 1.6.1, i encountered a null pointed exception @
java.lang.NullPointerException
    at org.jpos.iso.ISOUtil.str2bcd(ISOUtil.java:323)
    at org.jpos.iso.header.BASE1Header.setSource(BASE1Header.java:105)

I figured out that when i don't set the header i get this exception
ISOMsg m = new ISOMsg ();

                BASE1Header head = new BASE1Header();
                head.setFormat(1);
                head.setSource("000000");
                head.setDestination("000001");
                //m.setHeader(head);
               
                m.setMTI ("0800");
                m.set (3, "000000");
                m.set (41, "00000001");
                m.set (70, "301");

When i uncommented "m.setHeader(head)" it worked just fine. I guess this null pointer exception can be more gracefully handled.

Cheers
Radhakrishna


Re: JPOS 1.6 null pointer exception

by Mark Salter-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

santhoshvee wrote:
> Hi

Hello.

This should be asked on the jpos-users mailing list (google groups),
please head over there with any further questions.

>
> I was trying to upgrade my JPOS to V1.6.4. However, while running a sample code mentioned in the Jpos Guide 1.6.1, i encountered a null pointed exception @
> java.lang.NullPointerException
>     at org.jpos.iso.ISOUtil.str2bcd(ISOUtil.java:323)
>     at org.jpos.iso.header.BASE1Header.setSource(BASE1Header.java:105)

I suspect you have mixed a couple of Exceptions.  This could be a
problem if you passed null into BASE1Header.setSource, but this is not
the case in the code shown below?

>
> I figured out that when i don't set the header i get this exception
> ISOMsg m = new ISOMsg ();
>
> BASE1Header head = new BASE1Header();
> head.setFormat(1);
> head.setSource("000000");
> head.setDestination("000001");
> //m.setHeader(head);
>
> m.setMTI ("0800");
> m.set (3, "000000");
> m.set (41, "00000001");
> m.set (70, "301");
>
> When i uncommented "m.setHeader(head)" it worked just fine. I guess this null pointer exception can be more gracefully handled.

Please check your conditions, I think you may be presenting an invalid
situation.

If the 'problem' can be repeated, please post full Exception text and
code that produces the Exception to jpos-users at Google groups.

Thanks

--
Mark