Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Component-Sip-Servlets MSS-2.0.0.FINAL Roadmap-Fix

New issue 170 by [email protected]: Trailing '=' character added to flag parameters in URIs
http://code.google.com/p/sipservlets/issues/detail?id=170

What steps will reproduce the problem?
1. Set a flag parameter on an instance of URI by calling URI.setParameter() with a zero-length string as the value.
2. Use the URI in a request or print it out using toString().
3. Notice the trailing '=' after the parameter name.

What is the expected output? What do you see instead?
Flag parameters should be represented by the presence of their name only in the URI parameters (e.g. "tel:0123456;npdi"), however we are seeing "tel:0123456;npdi=".

What version of the product are you using? On what operating system?
MSS 1.7.0 on CentOS 5.8

Please provide any additional information below.
I have worked around the issue with the following code:

public static void setURIFlagParameter(final URI requestURI, final String parameter) {
        // First set the parameter on the mobicents URI implementation.
        // A flag parameter is set by passing an empty string as the value.
        requestURI.setParameter(parameter, "");

// Next workaround the bug by getting the parameters from the underlying // javax.sip.address.URI implementation and adding an explicitly-created
        // flag parameter (NameValue) to them.
        if (requestURI instanceof URIImpl) {
            NameValueList parameters = null;

            javax.sip.address.URI uri = ((URIImpl) requestURI).getURI();

            if (uri instanceof gov.nist.javax.sip.address.TelURLImpl) {
parameters = ((gov.nist.javax.sip.address.TelURLImpl) uri).getParameters();
            }

            if (uri instanceof gov.nist.javax.sip.address.SipUri) {
parameters = ((gov.nist.javax.sip.address.SipUri) uri).getParameters();
            }

            if (parameters != null) {
                // Create a NameValue with isFlag set to true
                parameters.set(new NameValue(parameter, "", true));
            }
        }
    }

Reply via email to