Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
essiembre committed Oct 8, 2016
2 parents 2477308 + 8aaedac commit 6a77ac3
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 15 deletions.
4 changes: 2 additions & 2 deletions norconex-commons-lang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.norconex.commons</groupId>
<artifactId>norconex-commons-lang</artifactId>
<version>1.12.1</version>
<version>1.12.2</version>
<packaging>jar</packaging>
<name>Norconex Commons Lang</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<site.baseurl/>
<currentStableVersion>1.12.1</currentStableVersion>
<currentStableVersion>1.12.2</currentStableVersion>
</properties>
<inceptionYear>2008</inceptionYear>

Expand Down
6 changes: 6 additions & 0 deletions norconex-commons-lang/src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
</properties>
<body>

<release version="1.12.2" date="2016-10-07" description="Bugfix release">
<action dev="essiembre" type="fix">
Fixed QueryString removing parameters without equal sign.
</action>
</release>

<release version="1.12.1" date="2016-09-17" description="Bugfix release">
<action dev="essiembre" type="fix">
Fixed URLNormalizer#sortQueryParameters() not handling #fragments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public JarFile[] getJarFiles() {
* The best attempt is made to detect more recent version based
* on version provided. Given version patterns may vary, there
* is no guarantee of 100% accuracy, so use with caution.
* @return
* @return latest jar file
*/
public JarFile getLatestVersion() {
return jarFiles[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,22 @@ public QueryString(String urlWithQueryString, String encoding) {
String[] paramParts = paramString.split("\\&");
for (int i = 0; i < paramParts.length; i++) {
String paramPart = paramParts[i];
String key;
String value;
if (StringUtils.contains(paramPart, "=")) {
String key = StringUtils.substringBefore(paramPart, "=");
String value = StringUtils.substringAfter(paramPart, "=");
try {
addString(URLDecoder.decode(key, this.encoding),
URLDecoder.decode(value, this.encoding));
} catch (UnsupportedEncodingException e) {
throw new URLException(
"Cannot URL-decode query string (key="
+ key + "; value=" + value + ").", e);
}
key = StringUtils.substringBefore(paramPart, "=");
value = StringUtils.substringAfter(paramPart, "=");
} else {
key = paramPart;
value = StringUtils.EMPTY;
}
try {
addString(URLDecoder.decode(key, this.encoding),
URLDecoder.decode(value, this.encoding));
} catch (UnsupportedEncodingException e) {
throw new URLException(
"Cannot URL-decode query string (key="
+ key + "; value=" + value + ").", e);
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions norconex-commons-lang/src/site/markdown/download.md.vm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#*
Copyright 2010-2014 Norconex Inc.
Copyright 2010-2016 Norconex Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,10 @@ $h2 Binaries

**Older Releases**

* [1.12.1]($nexusPath/1.12.1/norconex-commons-lang-1.12.1.zip)<small>
[[Release Notes](changes-report.html#a1.12.1)]</small>
* [1.12.0]($nexusPath/1.12.0/norconex-commons-lang-1.12.0.zip)<small>
[[Release Notes](changes-report.html#a1.12.0)]</small>
* [1.11.0]($nexusPath/1.11.0/norconex-commons-lang-1.11.0.zip)<small>
[[Release Notes](changes-report.html#a1.11.0)]</small>
* [1.10.0]($nexusPath/1.10.0/norconex-commons-lang-1.10.0.zip)<small>
Expand Down Expand Up @@ -69,7 +73,7 @@ $h2 Binaries

$h2 Source

Source code can be obtained on GitHub: (https://github.com/Norconex/commons-lang).
Source code can be obtained on GitHub: ([https://github.com/Norconex/commons-lang](https://github.com/Norconex/commons-lang)).

Maven users can add the following to their pom.xml:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2016 Norconex Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.norconex.commons.lang.url;

import org.junit.Assert;
import org.junit.Test;

public class QueryStringTest {

// This tests issue: https://github.com/Norconex/collector-http/issues/304
@Test
public void testKeepProtocolUpperCase() {
QueryString qs = new QueryString(
"http://site.com/page?NoEquals&WithEquals=EqualsValue");

Assert.assertTrue("Argument without equal sign was not found.",
qs.toString().contains("NoEquals"));
}
}

0 comments on commit 6a77ac3

Please sign in to comment.