From c208076ca21b3b97ac819480c3c3b61e397d24b4 Mon Sep 17 00:00:00 2001 From: Pascal Essiembre Date: Mon, 19 Sep 2016 13:01:51 -0400 Subject: [PATCH 1/3] Javadoc + doc broken link fixes. --- .../main/java/com/norconex/commons/lang/jar/JarDuplicates.java | 2 +- norconex-commons-lang/src/site/markdown/download.md.vm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/norconex-commons-lang/src/main/java/com/norconex/commons/lang/jar/JarDuplicates.java b/norconex-commons-lang/src/main/java/com/norconex/commons/lang/jar/JarDuplicates.java index 1275571a..ce10a843 100644 --- a/norconex-commons-lang/src/main/java/com/norconex/commons/lang/jar/JarDuplicates.java +++ b/norconex-commons-lang/src/main/java/com/norconex/commons/lang/jar/JarDuplicates.java @@ -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]; diff --git a/norconex-commons-lang/src/site/markdown/download.md.vm b/norconex-commons-lang/src/site/markdown/download.md.vm index cf18f168..170ce8aa 100644 --- a/norconex-commons-lang/src/site/markdown/download.md.vm +++ b/norconex-commons-lang/src/site/markdown/download.md.vm @@ -69,7 +69,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: From cfa281d08934c026fda8d4ee313edb85f00d0d14 Mon Sep 17 00:00:00 2001 From: Pascal Essiembre Date: Fri, 7 Oct 2016 23:45:53 -0400 Subject: [PATCH 2/3] Fixed QueryString removing parameters without equal sign. --- norconex-commons-lang/pom.xml | 2 +- norconex-commons-lang/src/changes/changes.xml | 6 ++++ .../commons/lang/url/QueryString.java | 25 +++++++++------ .../commons/lang/url/QueryStringTest.java | 31 +++++++++++++++++++ 4 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 norconex-commons-lang/src/test/java/com/norconex/commons/lang/url/QueryStringTest.java diff --git a/norconex-commons-lang/pom.xml b/norconex-commons-lang/pom.xml index 7175662c..028082c2 100644 --- a/norconex-commons-lang/pom.xml +++ b/norconex-commons-lang/pom.xml @@ -19,7 +19,7 @@ 4.0.0 com.norconex.commons norconex-commons-lang - 1.12.1 + 1.12.2 jar Norconex Commons Lang diff --git a/norconex-commons-lang/src/changes/changes.xml b/norconex-commons-lang/src/changes/changes.xml index 4046cc71..7956f186 100644 --- a/norconex-commons-lang/src/changes/changes.xml +++ b/norconex-commons-lang/src/changes/changes.xml @@ -7,6 +7,12 @@ + + + Fixed QueryString removing parameters without equal sign. + + + Fixed URLNormalizer#sortQueryParameters() not handling #fragments diff --git a/norconex-commons-lang/src/main/java/com/norconex/commons/lang/url/QueryString.java b/norconex-commons-lang/src/main/java/com/norconex/commons/lang/url/QueryString.java index 653f553d..f4eda34e 100644 --- a/norconex-commons-lang/src/main/java/com/norconex/commons/lang/url/QueryString.java +++ b/norconex-commons-lang/src/main/java/com/norconex/commons/lang/url/QueryString.java @@ -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); } } } diff --git a/norconex-commons-lang/src/test/java/com/norconex/commons/lang/url/QueryStringTest.java b/norconex-commons-lang/src/test/java/com/norconex/commons/lang/url/QueryStringTest.java new file mode 100644 index 00000000..d9fd3ba9 --- /dev/null +++ b/norconex-commons-lang/src/test/java/com/norconex/commons/lang/url/QueryStringTest.java @@ -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")); + } +} From 8aaedac937d43b7063bcdda431c8e98ded020ffd Mon Sep 17 00:00:00 2001 From: Pascal Essiembre Date: Fri, 7 Oct 2016 23:52:28 -0400 Subject: [PATCH 3/3] Preparing for release. --- norconex-commons-lang/pom.xml | 2 +- norconex-commons-lang/src/site/markdown/download.md.vm | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/norconex-commons-lang/pom.xml b/norconex-commons-lang/pom.xml index 028082c2..3741c32c 100644 --- a/norconex-commons-lang/pom.xml +++ b/norconex-commons-lang/pom.xml @@ -27,7 +27,7 @@ UTF-8 UTF-8 - 1.12.1 + 1.12.2 2008 diff --git a/norconex-commons-lang/src/site/markdown/download.md.vm b/norconex-commons-lang/src/site/markdown/download.md.vm index 170ce8aa..53b3190c 100644 --- a/norconex-commons-lang/src/site/markdown/download.md.vm +++ b/norconex-commons-lang/src/site/markdown/download.md.vm @@ -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. @@ -30,6 +30,10 @@ $h2 Binaries **Older Releases** + * [1.12.1]($nexusPath/1.12.1/norconex-commons-lang-1.12.1.zip) + [[Release Notes](changes-report.html#a1.12.1)] + * [1.12.0]($nexusPath/1.12.0/norconex-commons-lang-1.12.0.zip) + [[Release Notes](changes-report.html#a1.12.0)] * [1.11.0]($nexusPath/1.11.0/norconex-commons-lang-1.11.0.zip) [[Release Notes](changes-report.html#a1.11.0)] * [1.10.0]($nexusPath/1.10.0/norconex-commons-lang-1.10.0.zip)