mirror of https://github.com/apache/activemq.git
apply patch for: https://issues.apache.org/jira/browse/AMQ-3209
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1079831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8700ab7cde
commit
4f9784dafc
|
@ -174,6 +174,10 @@ public class URISupport {
|
|||
String schemeSpecificPart = uri.getRawSchemeSpecificPart();
|
||||
// strip existing query if any
|
||||
int questionMark = schemeSpecificPart.lastIndexOf("?");
|
||||
// make sure question mark is not within parentheses
|
||||
if (questionMark < schemeSpecificPart.lastIndexOf(")")) {
|
||||
questionMark = -1;
|
||||
}
|
||||
if (questionMark > 0) {
|
||||
schemeSpecificPart = schemeSpecificPart.substring(0, questionMark);
|
||||
}
|
||||
|
|
|
@ -113,6 +113,28 @@ public class URISupportTest extends TestCase {
|
|||
parameters = URISupport.parseParameters(uri);
|
||||
}
|
||||
|
||||
public void testCompositeCreateURIWithQuery() throws Exception {
|
||||
String queryString = "query=value";
|
||||
URI originalURI = new URI("outerscheme:(innerscheme:innerssp)");
|
||||
URI querylessURI = originalURI;
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, null));
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, ""));
|
||||
assertEquals(new URI(querylessURI + "?" + queryString), URISupport.createURIWithQuery(originalURI, queryString));
|
||||
originalURI = new URI("outerscheme:(innerscheme:innerssp)?outerquery=0");
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, null));
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, ""));
|
||||
assertEquals(new URI(querylessURI + "?" + queryString), URISupport.createURIWithQuery(originalURI, queryString));
|
||||
originalURI = new URI("outerscheme:(innerscheme:innerssp?innerquery=0)");
|
||||
querylessURI = originalURI;
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, null));
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, ""));
|
||||
assertEquals(new URI(querylessURI + "?" + queryString), URISupport.createURIWithQuery(originalURI, queryString));
|
||||
originalURI = new URI("outerscheme:(innerscheme:innerssp?innerquery=0)?outerquery=0");
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, null));
|
||||
assertEquals(querylessURI, URISupport.createURIWithQuery(originalURI, ""));
|
||||
assertEquals(new URI(querylessURI + "?" + queryString), URISupport.createURIWithQuery(originalURI, queryString));
|
||||
}
|
||||
|
||||
private void verifyParams(Map<String,String> parameters) {
|
||||
assertEquals(parameters.get("proxyHost"), "localhost");
|
||||
assertEquals(parameters.get("proxyPort"), "80");
|
||||
|
|
Loading…
Reference in New Issue