Package javax.sip

Examples of javax.sip.InvalidArgumentException


      throw new NullPointerException(
          "Address for listening point is null!");
    if (transport == null)
      throw new NullPointerException("null transport");
    if (port <= 0)
      throw new InvalidArgumentException("bad port");

    if (!transport.equalsIgnoreCase("UDP")
        && !transport.equalsIgnoreCase("TLS")
        && !transport.equalsIgnoreCase("TCP")
        && !transport.equalsIgnoreCase("SCTP"))
      throw new TransportNotSupportedException("bad transport "
          + transport);

    /** Reusing an old stack instance */
    if (!this.isAlive()) {
      this.toExit = false;
      this.reInitialize();
    }

    String key = ListeningPointImpl.makeKey(address, port, transport);

    ListeningPointImpl lip = (ListeningPointImpl) listeningPoints.get(key);
    if (lip != null) {
      return lip;
    } else {
      try {
        InetAddress inetAddr = InetAddress.getByName(address);
        MessageProcessor messageProcessor = this
            .createMessageProcessor(inetAddr, port, transport);
        if (this.isLoggingEnabled(LogLevels.TRACE_DEBUG)) {
          this.getStackLogger().logDebug(
              "Created Message Processor: " + address
                  + " port = " + port + " transport = "
                  + transport);
        }
        lip = new ListeningPointImpl(this, port, transport);
        lip.messageProcessor = messageProcessor;
        messageProcessor.setListeningPoint(lip);
        this.listeningPoints.put(key, lip);
        // start processing messages.
        messageProcessor.start();
        return (ListeningPoint) lip;
      } catch (java.io.IOException ex) {
        if (isLoggingEnabled())
          getStackLogger().logError(
            "Invalid argument address = " + address + " port = "
                + port + " transport = " + transport);
        throw new InvalidArgumentException(ex.getMessage(), ex);
      }
    }
  }
View Full Code Here


        if (address == null)
            throw new NullPointerException("Address for listening point is null!");
        if (transport == null)
            throw new NullPointerException("null transport");
        if (port <= 0)
            throw new InvalidArgumentException("bad port");

        if (!transport.equalsIgnoreCase("UDP") && !transport.equalsIgnoreCase("TLS")
                && !transport.equalsIgnoreCase("TCP"))
            throw new TransportNotSupportedException("bad transport " + transport);

        /** Reusing an old stack instance */
        if (!this.isAlive()) {
            this.toExit = false;
            this.reInitialize();
        }

        String key = ListeningPointImpl.makeKey(address, port, transport);

        ListeningPointImpl lip = (ListeningPointImpl) listeningPoints.get(key);
        if (lip != null) {
            return lip;
        } else {
            try {
                InetAddress inetAddr = InetAddress.getByName(address);
                MessageProcessor messageProcessor = this.createMessageProcessor(inetAddr, port,
                        transport);
                if (this.isLoggingEnabled()) {
                    this.getLogWriter().logDebug(
                            "Created Message Processor: " + address + " port = " + port
                                    + " transport = " + transport);
                }
                lip = new ListeningPointImpl(this, port, transport);
                lip.messageProcessor = messageProcessor;
                messageProcessor.setListeningPoint(lip);
                this.listeningPoints.put(key, lip);
                // start processing messages.
                messageProcessor.start();
                return (ListeningPoint) lip;
            } catch (java.io.IOException ex) {
                getLogWriter().logError(
                        "Invalid argument address = " + address + " port = " + port
                                + " transport = " + transport);
                throw new InvalidArgumentException(ex.getMessage(), ex);
            }
        }
    }
View Full Code Here

   * @since JAIN SIP v1.1
   *
   */
  public void setExpires(int expires) throws InvalidArgumentException {
    if (expires < 0)
      throw new InvalidArgumentException("bad argument " + expires);
    this.expires = expires;
  }
View Full Code Here

   * @param port - the new integer value of the port of this ViaHeader
   */
  public void setPort(int port) throws InvalidArgumentException {

    if ( port!=-1 && (port<1 || port>65535)) {
      throw new InvalidArgumentException( "Port value out of range -1, [1..65535]" );
    }
       
    if (sentBy == null)
      sentBy = new HostPort();
    sentBy.setPort(port);
View Full Code Here

   * @throws InvalidArgumentException if supplied value is less than zero or
   * greater than 255, excluding -1 the default not set value.
   */
  public void setTTL(int ttl) throws InvalidArgumentException {
    if (ttl < 0 && ttl != -1)
      throw new InvalidArgumentException(
        "JAIN-SIP Exception"
          + ", Via, setTTL(), the ttl parameter is < 0");
    setParameter(new NameValue(ParameterNames.TTL, new Integer(ttl)));
  }
View Full Code Here

             {
                String serviceID = urn.split(ParameterNamesIms.SERVICE_ID_LABEL+".")[1];
               
                 if(serviceID.trim().equals(""))
            try {
              throw new InvalidArgumentException("URN should atleast have one sub-service");
            } catch (InvalidArgumentException e) {
             
              e.printStackTrace();
            }
            else
                pps.setSubserviceIdentifiers(serviceID);
             }
         else if(urn.contains(ParameterNamesIms.APPLICATION_ID_LABEL))
          {
           String appID = urn.split(ParameterNamesIms.APPLICATION_ID_LABEL)[1];
           if(appID.trim().equals(""))
          try {
            throw new InvalidArgumentException("URN should atleast have one sub-application");
          } catch (InvalidArgumentException e) {
            e.printStackTrace();
          }
          else
            pps.setApplicationIdentifiers(appID);
          }
         else
         {
           try {
        throw new InvalidArgumentException("URN is not well formed");
       
      } catch (InvalidArgumentException e) {
        e.printStackTrace();
              }
                }
View Full Code Here

   * @return the newly created CSeqHeader object.
   */
  public CSeqHeader createCSeqHeader( long sequenceNumber, String method)
    throws ParseException, InvalidArgumentException {
    if (sequenceNumber < 0)
      throw new InvalidArgumentException("bad arg " + sequenceNumber);
    if (method == null)
      throw new NullPointerException("null arg method");
    CSeq cseq = new CSeq();
    cseq.setMethod(method);
    cseq.setSeqNumber(sequenceNumber);
View Full Code Here

   * @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;
  }
View Full Code Here

   * @return the newly created ExpiresHeader object.
   */
  public ExpiresHeader createExpiresHeader(int expires)
    throws InvalidArgumentException {
    if (expires < 0)
      throw new InvalidArgumentException("bad value " + expires);
    Expires e = new Expires();
    e.setExpires(expires);

    return e;
  }
View Full Code Here

  * @return the newly created MaxForwardsHeader object.
  */
  public MaxForwardsHeader createMaxForwardsHeader(int maxForwards)
    throws InvalidArgumentException {
    if (maxForwards < 0 || maxForwards > 255)
      throw new InvalidArgumentException(
        "bad maxForwards arg " + maxForwards);
    MaxForwards m = new MaxForwards();
    m.setMaxForwards(maxForwards);

    return m;
View Full Code Here

TOP

Related Classes of javax.sip.InvalidArgumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.