2 Replies Latest reply on Jun 1, 2008 5:07 AM by Peter Kovgan

    I can encounter NullPointer in that place, is it OK?

    Peter Kovgan Newbie


      Here I check whether node exist or not

      if(node==null){
       node = rootNode.addChild(someFqn);
      }


      and here I put object into the node:
      node.put(key, obj);


      But what if eviction happened between those 2 parts of code?

      How can I defend myself agains NullPointerException?

      Please,suggest, what is best practice, excluding try/catch...?

      Thanks!
      Peter.