Program: 103473
Project: 103473
Buggy source:
/** 
 * Creates a REGISTER <tt>Request</tt> as per the specified parameters.
 * @param addressOfRecord the address that we shall be registering
 * @param registrationsExpiration the expiration interval for the AOR
 * @param callIdHeader the Call-ID header for our new <tt>Request</tt>.
 * @param cSeqValue the sequence number of the new request.
 * @return the newly created REGISTER <tt>Request</tt>
 * @throws InvalidArgumentException in case there's a problem with any ofthe arguments that we received for this request.
 * @throws ParseException in case there's a problem with any ofthe arguments that we received for this request.
 * @throws OperationFailedException if we have a problem with the<tt>MaxForwardsHeader</tt>.
 */
public Request createRegisterRequest(Address addressOfRecord,int registrationsExpiration,CallIdHeader callIdHeader,long cSeqValue) throws InvalidArgumentException, ParseException, OperationFailedException {
  FromHeader fromHeader=protocolProvider.getHeaderFactory().createFromHeader(addressOfRecord,SipMessageFactory.generateLocalTag());
  CSeqHeader cSeqHeader=protocolProvider.getHeaderFactory().createCSeqHeader(cSeqValue,Request.REGISTER);
  ToHeader toHeader=protocolProvider.getHeaderFactory().createToHeader(addressOfRecord,null);
  MaxForwardsHeader maxForwardsHeader=protocolProvider.getMaxForwardsHeader();
  String domain=((SipURI)toHeader.getAddress().getURI()).getHost();
  SipURI requestURI=protocolProvider.getAddressFactory().createSipURI(null,domain);
  ArrayList<ViaHeader> viaHeaders=protocolProvider.getLocalViaHeaders(requestURI);
  Request request=createRequest(requestURI,Request.REGISTER,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader);
  ExpiresHeader expHeader=null;
  for (int retry=0; retry < 2; retry++) {
    try {
      expHeader=protocolProvider.getHeaderFactory().createExpiresHeader(registrationsExpiration);
    }
 catch (    InvalidArgumentException ex) {
      if (retry == 0) {
        registrationsExpiration=3600;
        continue;
      }
      throw new IllegalArgumentException("String_Node_Str" + registrationsExpiration,ex);
    }
  }
  request.addHeader(expHeader);
  ContactHeader contactHeader=(ContactHeader)request.getHeader(ContactHeader.NAME);
  contactHeader.setExpires(registrationsExpiration);
  request.setHeader(contactHeader);
  return request;
}

Fixed version (ground truth):
/** 
 * Creates a REGISTER <tt>Request</tt> as per the specified parameters.
 * @param addressOfRecord the address that we shall be registering
 * @param registrationsExpiration the expiration interval for the AOR
 * @param callIdHeader the Call-ID header for our new <tt>Request</tt>.
 * @param cSeqValue the sequence number of the new request.
 * @return the newly created REGISTER <tt>Request</tt>
 * @throws InvalidArgumentException in case there's a problem with any ofthe arguments that we received for this request.
 * @throws ParseException in case there's a problem with any ofthe arguments that we received for this request.
 * @throws OperationFailedException if we have a problem with the<tt>MaxForwardsHeader</tt>.
 */
public Request createRegisterRequest(Address addressOfRecord,int registrationsExpiration,CallIdHeader callIdHeader,long cSeqValue) throws InvalidArgumentException, ParseException, OperationFailedException {
  FromHeader fromHeader=protocolProvider.getHeaderFactory().createFromHeader(addressOfRecord,SipMessageFactory.generateLocalTag());
  CSeqHeader cSeqHeader=protocolProvider.getHeaderFactory().createCSeqHeader(cSeqValue,Request.REGISTER);
  ToHeader toHeader=protocolProvider.getHeaderFactory().createToHeader(addressOfRecord,null);
  MaxForwardsHeader maxForwardsHeader=protocolProvider.getMaxForwardsHeader();
  String domain=protocolProvider.getAccountID().getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
  SipURI requestURI=protocolProvider.getAddressFactory().createSipURI(null,domain);
  ArrayList<ViaHeader> viaHeaders=protocolProvider.getLocalViaHeaders(requestURI);
  Request request=createRequest(requestURI,Request.REGISTER,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader);
  ExpiresHeader expHeader=null;
  for (int retry=0; retry < 2; retry++) {
    try {
      expHeader=protocolProvider.getHeaderFactory().createExpiresHeader(registrationsExpiration);
    }
 catch (    InvalidArgumentException ex) {
      if (retry == 0) {
        registrationsExpiration=3600;
        continue;
      }
      throw new IllegalArgumentException("String_Node_Str" + registrationsExpiration,ex);
    }
  }
  request.addHeader(expHeader);
  ContactHeader contactHeader=(ContactHeader)request.getHeader(ContactHeader.NAME);
  contactHeader.setExpires(registrationsExpiration);
  request.setHeader(contactHeader);
  return request;
}