#vulnerable code 
                              @Test
  public void testInvocation() throws Exception
  {
    System.out.println("TestCMTaskHandler.testInvocation()");
    Message message = new Message(MessageType.STATE_TRANSITION);
    message.setSrcName("cm-instance-0");
    message.setTgtSessionId("1234");
    message.setFromState("Offline");
    message.setToState("Slave");
    message.setStateUnitKey("Teststateunitkey");
    message.setId("Some unique id");
    message.setMsgId("Some unique message id");
    message.setStateUnitGroup("TeststateunitGroup");
    MockStateModel stateModel = new MockStateModel();
    NotificationContext context;

    context = new NotificationContext(new MockManager());
    CMTaskHandler handler;
    handler = new CMTaskHandler(message, context, null, null);
    handler.call();
    AssertJUnit.assertTrue(stateModel.stateModelInvoked);
  } 
                            #location 20 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              @Test
  public void testInvocation() throws Exception
  {
    System.out.println("TestCMTaskHandler.testInvocation()");
    Message message = new Message(MessageType.STATE_TRANSITION);
    message.setSrcName("cm-instance-0");
    message.setTgtSessionId("1234");
    message.setFromState("Offline");
    message.setToState("Slave");
    message.setStateUnitKey("Teststateunitkey");
    message.setId("Some unique id");
    message.setMsgId("Some unique message id");
    message.setStateUnitGroup("TeststateunitGroup");
    MockStateModel stateModel = new MockStateModel();
    NotificationContext context;
    CMStateTransitionHandler stHandler = new CMStateTransitionHandler(stateModel);

    context = new NotificationContext(new MockManager());
    CMTaskHandler handler;
    handler = new CMTaskHandler(message, context, stHandler, null);
    handler.call();
    AssertJUnit.assertTrue(stateModel.stateModelInvoked);
  }