use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.
the class HeaderFactoryImpl method createContentLengthHeader.
/**
* Creates a new CSeqHeader based on the newly supplied contentLength value.
*
* @param contentLength - the new integer value of the contentLength.
* @throws InvalidArgumentException if supplied contentLength is less
* than zero.
* @return the newly created ContentLengthHeader object.
*/
public ContentLengthHeader createContentLengthHeader(int contentLength) throws InvalidArgumentException {
if (contentLength < 0)
throw new InvalidArgumentException("bad contentLength");
ContentLength c = new ContentLength();
c.setContentLength(contentLength);
return c;
}
use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.
the class HeaderFactoryImpl method createRetryAfterHeader.
/**
* Creates a new RetryAfterHeader based on the newly supplied retryAfter
* value.
*
* @param retryAfter - the new integer value of the retryAfter.
* @throws InvalidArgumentException if supplied retryAfter is less
* than zero.
* @return the newly created RetryAfterHeader object.
*/
public RetryAfterHeader createRetryAfterHeader(int retryAfter) throws InvalidArgumentException {
if (retryAfter < 0)
throw new InvalidArgumentException("bad retryAfter arg");
RetryAfter r = new RetryAfter();
r.setRetryAfter(retryAfter);
return r;
}
use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.
the class HeaderFactoryImpl method createRAckHeader.
/**
* Creates a new RAckHeader based on the newly supplied rSeqNumber,
* cSeqNumber and method values.
*
* @param rSeqNumber - the new integer value of the rSeqNumber.
* @param cSeqNumber - the new integer value of the cSeqNumber.
* @param method - the new string value of the method.
* @throws InvalidArgumentException if supplied rSeqNumber or cSeqNumber is
* less than zero or greater than than 2**31-1.
* @throws ParseException which signals that an error has been reached
* unexpectedly while parsing the method value.
* @return the newly created RAckHeader object.
* @since v1.1
*/
public RAckHeader createRAckHeader(long rSeqNumber, long cSeqNumber, String method) throws InvalidArgumentException, ParseException {
if (method == null)
throw new NullPointerException("Bad method");
if (cSeqNumber < 0 || rSeqNumber < 0)
throw new InvalidArgumentException("bad cseq/rseq arg");
RAck rack = new RAck();
rack.setMethod(method);
rack.setCSequenceNumber(cSeqNumber);
rack.setRSequenceNumber(rSeqNumber);
return rack;
}
use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.
the class TimeStamp method setTime.
public void setTime(long timeStamp) throws InvalidArgumentException {
if (timeStamp < -1)
throw new InvalidArgumentException("Illegal timestamp");
this.timeStamp = timeStamp;
this.timeStampFloat = -1;
}
use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.
the class MessageProcessor method getViaHeader.
/**
* Get the Via header to assign for this message processor. The topmost via
* header of the outoging messages use this.
*
* @return the ViaHeader to be used by the messages sent via this message processor.
*/
public Via getViaHeader() {
try {
Via via = new Via();
if (this.sentByHostPort != null) {
via.setSentBy(sentByHostPort);
via.setTransport(this.getTransport());
} else {
Host host = new Host();
host.setHostname(this.getIpAddress().getHostAddress());
via.setHost(host);
via.setPort(this.getPort());
via.setTransport(this.getTransport());
}
return via;
} catch (ParseException ex) {
ex.printStackTrace();
return null;
} catch (InvalidArgumentException ex) {
ex.printStackTrace();
return null;
}
}
Aggregations