java - How to bypass null pointer exception?#JPF -


i trying run jpf , encountered following null pointer exception.

java.lang.nullpointerexception @ gov.nasa.jpf.vm.threadinfo$stacktraceelement.createjpfstacktraceelement(threadinfo.java:1671) 

the code corresponds is:

int createjpfstacktraceelement() {     if (ignore) {         return mjienv.null;     } else {         heap heap = vm.getheap();         classinfo ci = classloaderinfo.getsystemresolvedclassinfo("java.lang.stacktraceelement");         elementinfo ei = heap.newobject(ci, threadinfo.this);          ei.setreferencefield("clsname", heap.newstring(clsname, threadinfo.this).getobjectref());         ei.setreferencefield("mthname", heap.newstring(mthname, threadinfo.this).getobjectref());         ei.setreferencefield("filename", heap.newstring(filename, threadinfo.this).getobjectref());  //line 1671         ei.setintfield("line", line);          return ei.getobjectref();     } } 

there 2 ways

  1. your code should contain null check, first of check if value null or not decided whether code snippet should execute or not.
  2. or can use try catch block.

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -