diff --git a/build.gradle b/build.gradle index 3d514a0..4c13ffe 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ subprojects { targetCompatibility = JavaVersion.VERSION_1_8 } tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all,-serial" << "-profile" << "compact1" + options.compilerArgs << "-Xlint:all,-serial" } jar { @@ -89,7 +89,7 @@ subprojects { imagesdir: 'img' } - javadoc { + /*javadoc { options.docletpath = configurations.asciidoclet.files.asType(List) options.doclet = 'org.asciidoctor.Asciidoclet' //options.overview = "src/docs/asciidoclet/overview.adoc" @@ -99,7 +99,7 @@ subprojects { configure(options) { noTimestamp = true } - } + }*/ task sourcesJar(type: Jar, dependsOn: classes) { classifier 'sources' diff --git a/gradle.properties b/gradle.properties index 3a575d7..c4f9d50 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group = org.xbib name = net -version = 1.2.1 +version = 1.2.2 jackson.version = 2.8.11 junit.version = 4.12 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738c..5c2d1cf 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f0f2faa..b005719 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jan 17 15:23:55 CET 2019 +#Tue Apr 16 23:50:27 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip diff --git a/gradlew b/gradlew index af6708f..b0d6d0a 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index 0f8d593..15e1ee3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/net-http/src/main/java/org/xbib/net/http/HttpParameters.java b/net-http/src/main/java/org/xbib/net/http/HttpParameters.java index bd94a75..4f3eecc 100644 --- a/net-http/src/main/java/org/xbib/net/http/HttpParameters.java +++ b/net-http/src/main/java/org/xbib/net/http/HttpParameters.java @@ -20,7 +20,7 @@ import java.util.SortedSet; * A limited multi-map of HTTP request parameters. Each key references a * limited set of parameters collected from the request during message * signing. Parameter values are sorted as per - * OAuth specification. + * OAuth specification. * Every key/value pair will be percent-encoded upon insertion. * This class has special semantics tailored to * being useful for message signing; it's not a general purpose collection class @@ -130,6 +130,8 @@ public class HttpParameters implements Map> { * @param key the parameter name * @param value the parameter value * @return the value + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String put(String key, String value) throws MalformedInputException, UnmappableCharacterException { @@ -145,6 +147,8 @@ public class HttpParameters implements Map> { * @param percentEncode whether key and value should be percent encoded before being * inserted into the map * @return the value + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String put(String key, String value, boolean percentEncode) throws MalformedInputException, UnmappableCharacterException { @@ -169,6 +173,8 @@ public class HttpParameters implements Map> { * @param key the parameter name * @param nullString can be anything, but probably... null? * @return null + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String putNull(String key, String nullString) throws MalformedInputException, UnmappableCharacterException { @@ -194,7 +200,7 @@ public class HttpParameters implements Map> { } /** - * Convenience method to merge a Map>. + * Convenience method to merge a {@code Map>}. * * @param m the map */ @@ -226,6 +232,8 @@ public class HttpParameters implements Map> { * characters!) * @param percentDecode whether the value being retrieved should be percent decoded * @return the first value found for this parameter + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String getFirst(String key, boolean percentDecode) throws MalformedInputException, UnmappableCharacterException { @@ -243,6 +251,8 @@ public class HttpParameters implements Map> { * * @param key the parameter name * @return the query string + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String getAsQueryString(String key) throws MalformedInputException, UnmappableCharacterException { @@ -257,6 +267,8 @@ public class HttpParameters implements Map> { * @param percentEncode whether key should be percent encoded before being * used with the map * @return the query string + * @throws MalformedInputException if input is malformed + * @throws UnmappableCharacterException if characters are unmappable */ public String getAsQueryString(String key, boolean percentEncode) throws MalformedInputException, UnmappableCharacterException { diff --git a/net-url/src/main/java/org/xbib/net/URL.java b/net-url/src/main/java/org/xbib/net/URL.java index 302c602..0e225ba 100755 --- a/net-url/src/main/java/org/xbib/net/URL.java +++ b/net-url/src/main/java/org/xbib/net/URL.java @@ -253,6 +253,7 @@ public class URL implements Comparable { /** * Return a special URL denoting the fact that this URL should be considered as invalid. * The URL has a null scheme. + * @return url */ public static URL nullUrl() { return NULL_URL; @@ -409,6 +410,7 @@ public class URL implements Comparable { /** * Get the percent-decoded path of the {@code URL} if it exists. + * @return decoded path */ public String getDecodedPath() { return decode(path); diff --git a/net-url/src/test/java/org/xbib/net/URLParserTest.java b/net-url/src/test/java/org/xbib/net/URLParserTest.java index ebfd6c4..1ef99de 100644 --- a/net-url/src/test/java/org/xbib/net/URLParserTest.java +++ b/net-url/src/test/java/org/xbib/net/URLParserTest.java @@ -159,6 +159,16 @@ public class URLParserTest { assertRoundTrip(url.toExternalForm()); } + @Test + public void testPassword() throws Exception { + URL url = URL.from("ftp://aaa:b%2B1@www.google.com"); + assertEquals("b+1", url.getPassword()); + assertRoundTrip(url.toExternalForm()); + url = URL.from("ftp://aaa:b+1@www.google.com"); + assertEquals("b+1", url.getPassword()); + assertRoundTrip(url.toExternalForm()); + } + @Test public void testPlus() throws Exception { URL url = URL.from("http://foobar:8080/test/print?value=%EA%B0%80+%EB%82%98"); diff --git a/net-url/src/test/java/org/xbib/net/path/PathDecoderTest.java b/net-url/src/test/java/org/xbib/net/path/PathDecoderTest.java index b6082ba..3aca363 100644 --- a/net-url/src/test/java/org/xbib/net/path/PathDecoderTest.java +++ b/net-url/src/test/java/org/xbib/net/path/PathDecoderTest.java @@ -1,10 +1,15 @@ package org.xbib.net.path; import org.junit.Test; +import org.xbib.net.URL; import static org.junit.Assert.assertEquals; +import java.nio.charset.MalformedInputException; import java.nio.charset.StandardCharsets; +import java.nio.charset.UnmappableCharacterException; +import java.util.logging.Level; +import java.util.logging.Logger; /** */ @@ -37,4 +42,30 @@ public class PathDecoderTest { assertEquals("[b c]", decoder.params().get("a").toString()); assertEquals("[e f]", decoder.params().get("d").toString()); } + + @Test + public void testPlusPercent() throws Exception { + PathDecoder decoder = new PathDecoder("//path?a=b%2Bc", "d=e%2Bf", StandardCharsets.UTF_8); + assertEquals("/path", decoder.path()); + assertEquals("[b+c]", decoder.params().get("a").toString()); + assertEquals("[e+f]", decoder.params().get("d").toString()); + } + + @Test + public void decodeURL() throws MalformedInputException, UnmappableCharacterException { + String requestURI = "/pdfconverter/index.gtpl?x-fl-key=20190035592&x-fl-source=ftp://DE-465:r09t00k25@herakles.hbz-nrw.de/fl/upload/20190035592/20190035592.pdf&x-fl-target=ftp://DE-1073:haribo%2B1@herakles.hbz-nrw.de/fl/download/20190035592/Fernleihe_Kopienlieferung_null_FB201900373_BLQDMT62_20190035592_20190035592.pdf&x-fl-copy=&x-fl-ack=https://fl.hbz-nrw.de/app/ack/index.gtpl&x-fl-pages=1-"; + URL url = URL.builder().path(requestURI).build(); + log.log(Level.INFO, "URL: url=" + url + " path=" + url.getPath() + " query=" + url.getQuery() + + " fragment=" + url.getFragment()); + PathDecoder decoder = new PathDecoder(requestURI, StandardCharsets.UTF_8); + if (url.getQuery() != null) { + decoder.parse(url.getDecodedQuery()); + } + log.log(Level.INFO, "decoded query=" + url.getDecodedQuery()); + log.log(Level.INFO, "path decoder params=" + decoder.params()); + url = URL.from(decoder.params().get("x-fl-target").get(0)); + log.log(Level.INFO, "url=" + url); + } + + private static final Logger log = Logger.getLogger(PathDecoderTest.class.getName()); }