cancel
Showing results for 
Search instead for 
Did you mean: 

Null pointer exception

Former Member
0 Kudos

Hi,

Can u please explain what is a null pointer exception

and when it comes into picture

Thanks

guna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi sekhar,

Null pointer exception is occured when you perform some operation on an object which is null or calling some method on the object that is null, you should not try to handle that exception i.e., DONT try ...catch the null pointer exception. It is nothing but patching the problem and it is not the right way. You should try to avoid performing any operation on null object.

In XI it will occure only in mapping (Graphical mapping and java mapping) if u used any UDF in it.

refer the following link

http://c2.com/cgi/wiki?NullPointerException

Regards,

Rohit

Reward points if helpful

Answers (3)

Answers (3)

Former Member
0 Kudos

hi

thanks for the answer

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Frnds,

Null Pointer Exception in SAP XI is similar in JAVA also,Because NetWeaver Based on JAVA,ABAP Stack...

when you are writing any UDF don't forget to catch the exception, How to catch the exception showed below...

When you encounter a NULL pointer exception ( Null pointer exception is the exception that is thrown by the JVM when you perform some operation on an object which is null or calling some method on the object that is null), you should not try to handle that exception i.e., DONT try ...catch the null pointer exception. It is nothing but patching the problem and it isin't the right way. You should try to avoid performing any operation on null object.

Eg:

object.method();

Assume this statement generates a null pointer exception.

Wrong method :

try {

object.method();

} catch ( Exception Ex) {

// handle the exception

}

Correct Method :

if ( object != null) {

object.method();

}

dharamveer_gaur2
Active Contributor
0 Kudos

plz explain where u r getting this error ,mapping or any java function developement.

This error comes when any object that holds null value calls any method.

i think what u done,u initalized a object by null and calling a mehod using that object.

so,initialize your object by proper value then call method.

Former Member
0 Kudos

Hi guna,

This error is frequent in mappings when you do some operation on a null object...

Check this out..

Regards

Arpil

Reward points if useful