Program: 69944
Project: 69944
Buggy source:
/** 
 * Create a session code with a one hour expiration date
 * @param identity
 * @param booking
 * @return
 */
protected String createVMSSessionCode(Identity identity) throws VmsNotAvailableException {
  try {
    int userId=getVmsUserId(identity,true);
    try {
      updateVmsUser(identity,userId);
      storePortrait(identity,userId);
    }
 catch (    Exception e) {
      logError("String_Node_Str" + identity.getName(),e);
    }
    SessionCodeServiceStub sessionCodeWs=getSessionCodeWebService();
    SessionCodeServiceStub.CreateVmsSessionCodeRequest codeRequest=new SessionCodeServiceStub.CreateVmsSessionCodeRequest();
    SessionCodeServiceStub.Sessioncode_type1 code=new SessionCodeServiceStub.Sessioncode_type1();
    code.setUserid(userId);
    code.setTimezone(viteroModule.getTimeZoneId());
    Calendar cal=Calendar.getInstance();
    cal.setTime(new Date());
    cal.add(Calendar.HOUR,1);
    code.setExpirationdate(format(cal.getTime()));
    codeRequest.setSessioncode(code);
    SessionCodeServiceStub.CreateVmsSessionCodeResponse response=sessionCodeWs.createVmsSessionCode(codeRequest);
    SessionCodeServiceStub.Codetype myCode=response.getCreateVmsSessionCodeResponse();
    return myCode.getCode();
  }
 catch (  AxisFault f) {
    ErrorCode code=handleAxisFault(f);
switch (code) {
case userDoesntExist:
      logError("String_Node_Str",f);
    break;
case userNotAssignedToGroup:
  logError("String_Node_Str",f);
break;
case invalidAttribut:
logError("String_Node_Str",f);
break;
case invalidTimezone:
logError("String_Node_Str",f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
logError("String_Node_Str",f);
break;
default :
logAxisError("String_Node_Str",f);
}
return null;
}
catch (RemoteException e) {
logError("String_Node_Str",e);
return null;
}
}

Fixed version (ground truth):
/** 
 * Create a session code with a one hour expiration date
 * @param identity
 * @param booking
 * @return
 */
protected String createVMSSessionCode(Identity identity) throws VmsNotAvailableException {
  try {
    GetUserInfo userInfo=getVmsUserId(identity,true);
    int userId=userInfo.getUserId();
    if (!userInfo.isCreated()) {
      try {
        updateVmsUser(identity,userId);
        storePortrait(identity,userId);
      }
 catch (      Exception e) {
        logError("String_Node_Str" + identity.getName(),e);
      }
    }
    SessionCodeServiceStub sessionCodeWs=getSessionCodeWebService();
    SessionCodeServiceStub.CreateVmsSessionCodeRequest codeRequest=new SessionCodeServiceStub.CreateVmsSessionCodeRequest();
    SessionCodeServiceStub.Sessioncode_type1 code=new SessionCodeServiceStub.Sessioncode_type1();
    code.setUserid(userId);
    code.setTimezone(viteroModule.getTimeZoneId());
    Calendar cal=Calendar.getInstance();
    cal.setTime(new Date());
    cal.add(Calendar.HOUR,1);
    code.setExpirationdate(format(cal.getTime()));
    codeRequest.setSessioncode(code);
    SessionCodeServiceStub.CreateVmsSessionCodeResponse response=sessionCodeWs.createVmsSessionCode(codeRequest);
    SessionCodeServiceStub.Codetype myCode=response.getCreateVmsSessionCodeResponse();
    return myCode.getCode();
  }
 catch (  AxisFault f) {
    ErrorCode code=handleAxisFault(f);
switch (code) {
case userDoesntExist:
      logError("String_Node_Str",f);
    break;
case userNotAssignedToGroup:
  logError("String_Node_Str",f);
break;
case invalidAttribut:
logError("String_Node_Str",f);
break;
case invalidTimezone:
logError("String_Node_Str",f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
logError("String_Node_Str",f);
break;
default :
logAxisError("String_Node_Str",f);
}
return null;
}
catch (RemoteException e) {
logError("String_Node_Str",e);
return null;
}
}