You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Fernando Rafael Ferreira (JIRA)" <ji...@apache.org> on 2012/05/04 14:00:48 UTC

[jira] [Created] (AMQ-3828) URISupport incorrectly handles parenthesis

Fernando Rafael Ferreira created AMQ-3828:
---------------------------------------------

             Summary: URISupport incorrectly handles parenthesis
                 Key: AMQ-3828
                 URL: https://issues.apache.org/jira/browse/AMQ-3828
             Project: ActiveMQ
          Issue Type: Bug
          Components: Transport
    Affects Versions: 5.5.1, 6.0.0
            Reporter: Fernando Rafael Ferreira
            Priority: Minor


URISupport.parseComposite(URI) incorrectly parses an URI with a closing parenthesis ")" in the query part.

{code}
// The URI is parsed incorrectly when there is an unescaped ')'
URI uri = new URI("failover://()?updateURIsURL=file:/C:/Dir(1)/a.csv");
CompositeData data = URISupport.parseComposite(uri);

// Parsed Composite Data:
// - Components: [)?updateURIsURL=file:/C:/Dir(1]
// -   Fragment: null
// -       Host: 
// - Parameters: {}
// -       Path: a.csv
// -     Scheme: failover

// The URI is parsed correctly when it is an escaped
URI uri = new URI("failover://()?updateURIsURL=file:/C:/Dir%281%29/a.csv");
CompositeData data = URISupport.parseComposite(uri);
	
// Parsed Composite Data: 
// - Components: []
// -   Fragment: null
// -       Host: 
// - Parameters: {updateURIsURL=file:/C:/Dir(1)/a.csv}
// -       Path: null
// -     Scheme: failover
{code}

I think {{URISupport}} should either throw an URISyntaxException or parse it correctly.
See [RFC2396|http://www.ietf.org/rfc/rfc2396.txt]:
{quote}
Unreserved characters can be escaped without changing the semantics
of the URI, but this should not be done unless the URI is being used
in a context that does not allow the unescaped character to appear.
{quote}

By the way, the problem occurs in the method {{parseComposite(URI uri, CompositeData rc, String ssp)}}, at:

{code}
...
p = ssp.lastIndexOf(")");
...
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (AMQ-3828) URISupport incorrectly handles parenthesis

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQ-3828.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 5.7.0
         Assignee: Timothy Bish

Fix added along with test additions for this case.
                
> URISupport incorrectly handles parenthesis
> ------------------------------------------
>
>                 Key: AMQ-3828
>                 URL: https://issues.apache.org/jira/browse/AMQ-3828
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 5.5.1, 6.0.0
>            Reporter: Fernando Rafael Ferreira
>            Assignee: Timothy Bish
>            Priority: Minor
>              Labels: CompositeData, URI, parser
>             Fix For: 5.7.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> URISupport.parseComposite(URI) incorrectly parses an URI with a closing parenthesis ")" in the query part.
> {code}
> // The URI is parsed incorrectly when there is an unescaped ')'
> URI uri = new URI("failover://()?updateURIsURL=file:/C:/Dir(1)/a.csv");
> CompositeData data = URISupport.parseComposite(uri);
> // Parsed Composite Data:
> // - Components: [)?updateURIsURL=file:/C:/Dir(1]
> // -   Fragment: null
> // -       Host: 
> // - Parameters: {}
> // -       Path: a.csv
> // -     Scheme: failover
> // The URI is parsed correctly when it is an escaped
> URI uri = new URI("failover://()?updateURIsURL=file:/C:/Dir%281%29/a.csv");
> CompositeData data = URISupport.parseComposite(uri);
> 	
> // Parsed Composite Data: 
> // - Components: []
> // -   Fragment: null
> // -       Host: 
> // - Parameters: {updateURIsURL=file:/C:/Dir(1)/a.csv}
> // -       Path: null
> // -     Scheme: failover
> {code}
> I think {{URISupport}} should either throw an URISyntaxException or parse it correctly.
> See [RFC2396|http://www.ietf.org/rfc/rfc2396.txt]:
> {quote}
> Unreserved characters can be escaped without changing the semantics
> of the URI, but this should not be done unless the URI is being used
> in a context that does not allow the unescaped character to appear.
> {quote}
> By the way, the problem occurs in the method {{parseComposite(URI uri, CompositeData rc, String ssp)}}, at:
> {code}
> ...
> p = ssp.lastIndexOf(")");
> ...
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira