Support Article
Null pointer exception error in copyObject
SA-6734
Summary
NullPointerException in copyObject() method in CompiledProcessBase has an underlying NonSerializableException.
Developer suggests change in this method to throw back original exception without eating the underlying cause. Right now, writeObject in copyObject() is throwing NonSerializableException
Error Messages
Nullpointer Exception
Steps to Reproduce
Any workflow file will have below line for serializing the context variable:
if(mto != null) {
ctxMap.put("mto",(com.gcg.cdf.framework.messaging.objects.MessageTransferObject)copyObject(mto));
If mto here is not implementing Serializable, copyObject() is throwing NullPointerException which are see in console and process canceled screen.
Root Cause
NullPointerException in copyObject method of CompiledProcessBase class has an underlying NonSerializableException. Here, writeObject method throws NonSerializableException (if the context variable passed in Compiled workflow does not implement Serializable). This further becomes NullpointerException because of the object is being null. NullPointerException is seen in the server console and process screen.
Resolution
HFix-904 has been provided which address the above issue by adding null checks, try-catch block and LogHelper.error statements in copyObject method of CompiledProcessBase class.
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.