Program: 104433
Project: 104433
Buggy source:
/** 
 * Sends the REGISTER request to the server speciied in the constructor.
 * @throws OperationFailedException with the corresponding error codeif registration or construction of the Register request fail.
 */
void register() throws OperationFailedException {
  setRegistrationState(RegistrationState.REGISTERING,RegistrationStateChangeEvent.REASON_NOT_SPECIFIED,null);
  FromHeader fromHeader=null;
  try {
    fromHeader=sipProvider.getHeaderFactory().createFromHeader(sipProvider.getOurSipAddress(),ProtocolProviderServiceSipImpl.generateLocalTag());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  CallIdHeader callIdHeader=this.getRegistrarJainSipProvider().getNewCallId();
  CSeqHeader cSeqHeader=null;
  try {
    cSeqHeader=sipProvider.getHeaderFactory().createCSeqHeader(getNextCSeqValue(),Request.REGISTER);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  InvalidArgumentException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  ToHeader toHeader=null;
  try {
    toHeader=sipProvider.getHeaderFactory().createToHeader(sipProvider.getOurSipAddress(),null);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + fromHeader.getAddress(),ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str" + fromHeader.getAddress(),OperationFailedException.INTERNAL_ERROR,ex);
  }
  ArrayList viaHeaders=sipProvider.getLocalViaHeaders(registrarAddress,getRegistrarListeningPoint());
  MaxForwardsHeader maxForwardsHeader=sipProvider.getMaxForwardsHeader();
  Request request=null;
  try {
    request=sipProvider.getMessageFactory().createRequest(registrarURI,Request.REGISTER,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  UserAgentHeader userAgentHeader=sipProvider.getSipCommUserAgentHeader();
  if (userAgentHeader != null)   request.addHeader(userAgentHeader);
  ExpiresHeader expHeader=null;
  for (int retry=0; retry < 2; retry++) {
    try {
      expHeader=sipProvider.getHeaderFactory().createExpiresHeader(registrationsExpiration);
    }
 catch (    InvalidArgumentException ex) {
      if (retry == 0) {
        registrationsExpiration=3600;
        continue;
      }
      logger.error("String_Node_Str" + registrationsExpiration,ex);
      setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
      throw new OperationFailedException("String_Node_Str" + registrationsExpiration,OperationFailedException.INTERNAL_ERROR,ex);
    }
  }
  request.addHeader(expHeader);
  ContactHeader contactHeader=sipProvider.getRegistrationContactHeader(registrarAddress,getRegistrarListeningPoint());
  try {
    contactHeader.setExpires(registrationsExpiration);
  }
 catch (  InvalidArgumentException exc) {
    logger.error("String_Node_Str" + registrationsExpiration + "String_Node_Str"+ "String_Node_Str",exc);
  }
  request.addHeader(contactHeader);
  try {
    sipProvider.getJainSipStack().getSipProviders();
    regTrans=getRegistrarJainSipProvider().getNewClientTransaction(request);
  }
 catch (  TransactionUnavailableException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  try {
    regTrans.sendRequest();
    logger.debug("String_Node_Str" + request);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.NETWORK_FAILURE,ex);
  }
  this.registerRequest=request;
}

Fixed version (ground truth):
/** 
 * Sends the REGISTER request to the server speciied in the constructor.
 * @throws OperationFailedException with the corresponding error codeif registration or construction of the Register request fail.
 */
void register() throws OperationFailedException {
  setRegistrationState(RegistrationState.REGISTERING,RegistrationStateChangeEvent.REASON_NOT_SPECIFIED,null);
  FromHeader fromHeader=null;
  try {
    fromHeader=sipProvider.getHeaderFactory().createFromHeader(sipProvider.getOurSipAddress(),ProtocolProviderServiceSipImpl.generateLocalTag());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  CallIdHeader callIdHeader=this.getRegistrarJainSipProvider().getNewCallId();
  CSeqHeader cSeqHeader=null;
  try {
    cSeqHeader=sipProvider.getHeaderFactory().createCSeqHeader(getNextCSeqValue(),Request.REGISTER);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  InvalidArgumentException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  ToHeader toHeader=null;
  try {
    toHeader=sipProvider.getHeaderFactory().createToHeader(sipProvider.getOurSipAddress(),null);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + fromHeader.getAddress(),ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str" + fromHeader.getAddress(),OperationFailedException.INTERNAL_ERROR,ex);
  }
  ArrayList viaHeaders=sipProvider.getLocalViaHeaders(registrarAddress,getRegistrarListeningPoint());
  MaxForwardsHeader maxForwardsHeader=sipProvider.getMaxForwardsHeader();
  Request request=null;
  try {
    request=sipProvider.getMessageFactory().createRequest(registrarURI,Request.REGISTER,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  UserAgentHeader userAgentHeader=sipProvider.getSipCommUserAgentHeader();
  if (userAgentHeader != null)   request.addHeader(userAgentHeader);
  ExpiresHeader expHeader=null;
  for (int retry=0; retry < 2; retry++) {
    try {
      expHeader=sipProvider.getHeaderFactory().createExpiresHeader(registrationsExpiration);
    }
 catch (    InvalidArgumentException ex) {
      if (retry == 0) {
        registrationsExpiration=3600;
        continue;
      }
      logger.error("String_Node_Str" + registrationsExpiration,ex);
      setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
      throw new OperationFailedException("String_Node_Str" + registrationsExpiration,OperationFailedException.INTERNAL_ERROR,ex);
    }
  }
  request.addHeader(expHeader);
  ContactHeader contactHeader=sipProvider.getContactHeader(registrarAddress,getRegistrarListeningPoint());
  try {
    contactHeader.setExpires(registrationsExpiration);
  }
 catch (  InvalidArgumentException exc) {
    logger.error("String_Node_Str" + registrationsExpiration + "String_Node_Str"+ "String_Node_Str",exc);
  }
  request.addHeader(contactHeader);
  try {
    sipProvider.getJainSipStack().getSipProviders();
    regTrans=getRegistrarJainSipProvider().getNewClientTransaction(request);
  }
 catch (  TransactionUnavailableException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  try {
    regTrans.sendRequest();
    logger.debug("String_Node_Str" + request);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    setRegistrationState(RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,ex.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.NETWORK_FAILURE,ex);
  }
  this.registerRequest=request;
}