Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-3828

URISupport incorrectly handles parenthesis

    XMLWordPrintableJSON

Details

    Description

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

      // 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
      

      I think URISupport should either throw an URISyntaxException or parse it correctly.
      See RFC2396:

      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.

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

      ...
      p = ssp.lastIndexOf(")");
      ...
      

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            barata Fernando Rafael Ferreira
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified