From 51a19b2af7de3e6f8ffdad7fee9ecbf38b703fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Tue, 27 Feb 2018 11:39:04 +0100 Subject: [PATCH] remove serialization, add some more convenience to URL --- build.gradle | 2 +- gradle.properties | 6 +- gradle/publish.gradle | 2 + gradle/wrapper/gradle-wrapper.jar | Bin 54329 -> 54334 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- .../java/org/xbib/net/QueryParameters.java | 3 +- net-url/src/main/java/org/xbib/net/URL.java | 43 +++--- .../java/org/xbib/net/URLSyntaxException.java | 4 +- .../java/org/xbib/net/path/PathDecoder.java | 2 +- .../java/org/xbib/net/path/PathMatcher.java | 4 +- .../org/xbib/net/path/PathNormalizer.java | 139 +----------------- .../xbib/net/path/PathPatternComparator.java | 6 +- .../org/xbib/net/path/PathPatternInfo.java | 1 + .../net/path/PathSeparatorPatternCache.java | 1 + .../org/xbib/net/path/PathStringMatcher.java | 1 + .../org/xbib/net/scheme/DefaultScheme.java | 2 +- .../java/org/xbib/net/scheme/FileScheme.java | 2 +- .../java/org/xbib/net/scheme/FtpScheme.java | 2 +- .../java/org/xbib/net/scheme/GitScheme.java | 2 +- .../xbib/net/scheme/GitSecureHttpScheme.java | 2 +- .../org/xbib/net/scheme/GopherScheme.java | 2 +- .../java/org/xbib/net/scheme/HttpScheme.java | 2 +- .../java/org/xbib/net/scheme/RedisScheme.java | 2 +- .../java/org/xbib/net/scheme/RsyncScheme.java | 2 +- .../java/org/xbib/net/scheme/RtmpScheme.java | 2 +- .../org/xbib/net/scheme/SecureHttpScheme.java | 2 +- .../org/xbib/net/scheme/SecureImapScheme.java | 2 +- .../org/xbib/net/scheme/SecureLdapScheme.java | 2 +- .../org/xbib/net/scheme/SecureNewsScheme.java | 2 +- .../org/xbib/net/scheme/SecurePop3Scheme.java | 2 +- .../org/xbib/net/scheme/SecureSmtpScheme.java | 2 +- .../net/scheme/SecureWebSocketScheme.java | 2 +- .../java/org/xbib/net/scheme/SftpScheme.java | 2 +- .../java/org/xbib/net/scheme/SshScheme.java | 2 +- .../org/xbib/net/scheme/WebSocketScheme.java | 2 +- .../org/xbib/net/template/URITemplate.java | 2 +- .../template/expression/ExpressionType.java | 1 + .../expression/TemplateExpression.java | 1 + .../template/expression/TemplateLiteral.java | 1 + .../expression/URITemplateExpression.java | 1 + .../net/template/parse/ExpressionParser.java | 1 + .../net/template/parse/LiteralParser.java | 1 + .../net/template/parse/TemplateParser.java | 2 +- .../net/template/parse/URITemplateParser.java | 1 + .../template/parse/VariableSpecParser.java | 1 + .../net/template/render/ListRenderer.java | 2 +- .../xbib/net/template/render/MapRenderer.java | 2 +- .../template/render/MultiValueRenderer.java | 2 +- .../net/template/render/NullRenderer.java | 2 +- .../net/template/render/StringRenderer.java | 2 +- .../net/template/render/ValueRenderer.java | 1 - .../org/xbib/net/template/vars/Variables.java | 1 + .../template/vars/specs/ExplodedVariable.java | 2 +- .../net/template/vars/values/ListValue.java | 2 +- .../net/template/vars/values/MapValue.java | 2 +- .../net/template/vars/values/NullValue.java | 1 + .../net/template/vars/values/ScalarValue.java | 2 +- .../net/template/vars/values/ValueType.java | 1 + .../template/vars/values/VariableValue.java | 1 + .../src/test/java/org/xbib/net/IRITest.java | 2 +- .../test/java/org/xbib/net/URLParserTest.java | 7 +- .../java/org/xbib/net/URLResolverTest.java | 6 +- 62 files changed, 93 insertions(+), 214 deletions(-) diff --git a/build.gradle b/build.gradle index b6d086b..3c8825e 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ subprojects { [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-profile" << "compact1" + options.compilerArgs << "-Xlint:all,-serial" << "-profile" << "compact1" } jar { diff --git a/gradle.properties b/gradle.properties index c3c29cf..fe8c09a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group = org.xbib name = net -version = 1.0.4 +version = 1.1.0 junit.version = 4.12 asciidoclet.version = 1.5.4 -wagon.version = 2.12 -jackson.version = 2.8.4 +wagon.version = 3.0.0 +jackson.version = 2.8.10 diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 1b4e9b7..9e532b0 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -1,5 +1,6 @@ task xbibUpload(type: Upload) { + group = 'publish' configuration = configurations.archives uploadDescriptor = true repositories { @@ -15,6 +16,7 @@ task xbibUpload(type: Upload) { } task sonatypeUpload(type: Upload, dependsOn: build) { + group = 'publish' configuration = configurations.archives uploadDescriptor = true repositories { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 01b8bf6b1f99cad9213fc495b33ad5bbab8efd20..8252d7e25c5b548b131082159ee03249a5d36511 100644 GIT binary patch delta 85 zcmdnFf_dKx<_YF38otMVOtg+<`&jg`h>>A})W$9U4vJjX^}1%t!Vuui&QW`L_E!l8 f1_rUo2M>9HRd41$d{2NAA^z>ME!)XMKqU+S`lKQJ delta 87 zcmdnDf_di(<_YF39&&6=6RjiJJ`{Z{Vq};gwQ> { - private static final long serialVersionUID = 1195469379836789386L; - private final int max; public QueryParameters() { 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 a92e3ec..cf3ab64 100755 --- a/net-url/src/main/java/org/xbib/net/URL.java +++ b/net-url/src/main/java/org/xbib/net/URL.java @@ -3,7 +3,6 @@ package org.xbib.net; import org.xbib.net.scheme.Scheme; import org.xbib.net.scheme.SchemeRegistry; -import java.io.Serializable; import java.net.IDN; import java.net.Inet4Address; import java.net.Inet6Address; @@ -43,12 +42,10 @@ import java.util.logging.Logger; * -- * */ -public class URL implements Comparable, Serializable { +public class URL implements Comparable { private static final Logger logger = Logger.getLogger(URL.class.getName()); - private static final long serialVersionUID = 7936984038051707342L; - private static final char SEPARATOR_CHAR = '/'; private static final char QUESTION_CHAR = '?'; @@ -102,7 +99,7 @@ public class URL implements Comparable, Serializable { /** * A special, scheme-less URL denoting the fact that this URL should be considered as invalid. */ - public static final URL INVALID = URL.builder().build(); + private static final URL INVALID = URL.builder().build(); public static Builder file() { return new Builder().scheme(Scheme.FILE); @@ -236,33 +233,45 @@ public class URL implements Comparable, Serializable { return new Resolver(URL.create(base)); } + public static URL getInvalid() { + return INVALID; + } + public static URL from(String input) { - try { - return parser().parse(input, true); - } catch (URLSyntaxException e) { - throw new IllegalArgumentException(e); - } + return from(input, true); } public static URL create(String input) { + return from(input, false); + } + + public static URL from(String input, boolean resolve) { try { - return parser().parse(input, false); + return parser().parse(input, resolve); } catch (URLSyntaxException e) { throw new IllegalArgumentException(e); } } public URL resolve(String spec) { + return from(this, spec); + } + + public static URL from(URL base, String spec) { try { - return new Resolver(this).resolve(spec); + return new Resolver(base).resolve(spec); } catch (URLSyntaxException e) { throw new IllegalArgumentException(e); } } public URL resolve(URL spec) { + return from(this, spec); + } + + public static URL from(URL base, URL spec) { try { - return new Resolver(this).resolve(spec); + return new Resolver(base).resolve(spec); } catch (URLSyntaxException e) { throw new IllegalArgumentException(e); } @@ -1252,9 +1261,7 @@ public class URL implements Comparable, Serializable { } } - private static class URLWithFragmentComparator implements Comparator, Serializable { - - private static final long serialVersionUID = -5048272347975931901L; + private static class URLWithFragmentComparator implements Comparator { @Override public int compare(URL o1, URL o2) { @@ -1262,9 +1269,7 @@ public class URL implements Comparable, Serializable { } } - private static class URLWithoutFragmentComparator implements Comparator, Serializable { - - private static final long serialVersionUID = 818948352939772199L; + private static class URLWithoutFragmentComparator implements Comparator { @Override public int compare(URL o1, URL o2) { diff --git a/net-url/src/main/java/org/xbib/net/URLSyntaxException.java b/net-url/src/main/java/org/xbib/net/URLSyntaxException.java index 8e7e8ca..40a13b0 100644 --- a/net-url/src/main/java/org/xbib/net/URLSyntaxException.java +++ b/net-url/src/main/java/org/xbib/net/URLSyntaxException.java @@ -1,12 +1,10 @@ package org.xbib.net; /** - * + * URL syntax exception. */ public class URLSyntaxException extends Exception { - private static final long serialVersionUID = 1813084470937980392L; - URLSyntaxException(String message) { super(message); } diff --git a/net-url/src/main/java/org/xbib/net/path/PathDecoder.java b/net-url/src/main/java/org/xbib/net/path/PathDecoder.java index 29cadc4..fcc449a 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathDecoder.java +++ b/net-url/src/main/java/org/xbib/net/path/PathDecoder.java @@ -13,7 +13,7 @@ import java.nio.charset.UnmappableCharacterException; */ public class PathDecoder { - private static final Integer MAX_PARAM_COUNT = 1000; + private static final Integer MAX_PARAM_COUNT = 1024; private PercentDecoder decoder; diff --git a/net-url/src/main/java/org/xbib/net/path/PathMatcher.java b/net-url/src/main/java/org/xbib/net/path/PathMatcher.java index c1dae20..890ab73 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathMatcher.java +++ b/net-url/src/main/java/org/xbib/net/path/PathMatcher.java @@ -11,7 +11,7 @@ import java.util.Map; import java.util.StringTokenizer; /** - * + * Path matcher. */ public class PathMatcher { @@ -312,8 +312,6 @@ public class PathMatcher { */ private static class LRUCache extends LinkedHashMap { - private static final long serialVersionUID = -2795566703268944901L; - private final int cacheSize; LRUCache(int cacheSize) { diff --git a/net-url/src/main/java/org/xbib/net/path/PathNormalizer.java b/net-url/src/main/java/org/xbib/net/path/PathNormalizer.java index 6a49283..e8e289a 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathNormalizer.java +++ b/net-url/src/main/java/org/xbib/net/path/PathNormalizer.java @@ -5,6 +5,7 @@ import java.util.LinkedList; import java.util.StringTokenizer; /** + * Path normalizer. */ public class PathNormalizer { @@ -13,100 +14,6 @@ public class PathNormalizer { private PathNormalizer() { } - /*public static String normalizePath(String path) { - return normalizePath(path, false); - } - - public static String normalizePath(String path, boolean keepSeparator) { - if (path == null || path.equals("") || path.equals("/")) { - return "/"; - } - path = path.replaceAll("/+", "/"); - int size = path.length(); - if (size == 0) { - return path; - } - int prefix = getPrefixLength(path); - if (prefix < 0) { - return ""; - } - char[] ch = new char[size + 2]; - path.getChars(0, path.length(), ch, 0); - boolean firstIsDirectory = true; - if (ch[0] != separator) { - firstIsDirectory = false; - } - boolean lastIsDirectory = true; - if (ch[size - 1] != separator) { - lastIsDirectory = false; - } - for (int i = prefix + 1; i < size; i++) { - if (ch[i] == separator && ch[i - 1] == separator) { - System.arraycopy(ch, i, ch, i - 1, size - i); - size--; - i--; - } - } - for (int i = prefix + 1; i < size; i++) { - if (ch[i] == separator && ch[i - 1] == '.' - && (i == prefix + 1 || ch[i - 2] == separator)) { - if (i == size - 1) { - lastIsDirectory = true; - } - System.arraycopy(ch, i + 1, ch, i - 1, size - i); - size -=2; - i--; - } - } - int i = prefix + 2; - while (i < size) { - if (ch[i] == separator && ch[i - 1] == '.' && ch[i - 2] == '.' - && (i == prefix + 2 || ch[i - 3] == separator)) { - if (i == prefix + 2) { - return ""; - } - if (i == size - 1) { - lastIsDirectory = true; - } - int j; - boolean b = false; - for (j = i - 4 ; j >= prefix; j--) { - if (ch[j] == separator) { - System.arraycopy(ch, i + 1, ch, j + 1, size - i); - size -= (i - j); - i = j + 1; - b = true; - break; - } - } - if (b) { - continue; - } - System.arraycopy(ch, i + 1, ch, prefix, size - i); - size -= (i + 1 - prefix); - i = prefix + 1; - } - i++; - } - if (size <= 0) { - return ""; - } - String s = new String(ch, 0, size); - if (size <= prefix) { - return s; - } - if (!keepSeparator) { - if (firstIsDirectory && lastIsDirectory) { - return s.substring(1, s.length() - 1); - } else if (firstIsDirectory) { - return s.substring(1); - } else if (lastIsDirectory) { - return s.substring(0, s.length() - 1); - } - } - return s; - }*/ - public static String normalize(String path) { if (path == null || "".equals(path) || "/".equals(path)) { return "/"; @@ -147,48 +54,4 @@ public class PathNormalizer { } return sb.toString(); } - - private static int getPrefixLength(String filename) { - if (filename == null) { - return -1; - } - int len = filename.length(); - if (len == 0) { - return 0; - } - char ch0 = filename.charAt(0); - if (ch0 == ':') { - return -1; - } - if (len == 1) { - if (ch0 == '~') { - return 2; - } - return ch0 == separator ? 1 : 0; - } else { - if (ch0 == '~') { - int pos = filename.indexOf(separator, 1); - return pos == -1 ? len + 1 : pos + 1; - } - char ch1 = filename.charAt(1); - if (ch1 == ':') { - ch0 = Character.toUpperCase(ch0); - if (ch0 >= ('A') && ch0 <= ('Z')) { - if (len == 2 || filename.charAt(2) != separator) { - return 2; - } - return 3; - } - return -1; - } else if (ch0 == separator && ch1 == separator) { - int pos = filename.indexOf(separator, 2); - if (pos == -1 || pos == 2) { - return -1; - } - return pos + 1; - } else { - return ch0 == separator ? 1 : 0; - } - } - } } diff --git a/net-url/src/main/java/org/xbib/net/path/PathPatternComparator.java b/net-url/src/main/java/org/xbib/net/path/PathPatternComparator.java index 4011570..e7c8096 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathPatternComparator.java +++ b/net-url/src/main/java/org/xbib/net/path/PathPatternComparator.java @@ -1,13 +1,11 @@ package org.xbib.net.path; -import java.io.Serializable; import java.util.Comparator; /** + * Path pattern comparator. */ -public class PathPatternComparator implements Comparator, Serializable { - - private static final long serialVersionUID = -5286803094119345841L; +public class PathPatternComparator implements Comparator { private final String path; diff --git a/net-url/src/main/java/org/xbib/net/path/PathPatternInfo.java b/net-url/src/main/java/org/xbib/net/path/PathPatternInfo.java index a113938..dd1c1b5 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathPatternInfo.java +++ b/net-url/src/main/java/org/xbib/net/path/PathPatternInfo.java @@ -3,6 +3,7 @@ package org.xbib.net.path; import java.util.regex.Pattern; /** + * Path pattern info. */ class PathPatternInfo { diff --git a/net-url/src/main/java/org/xbib/net/path/PathSeparatorPatternCache.java b/net-url/src/main/java/org/xbib/net/path/PathSeparatorPatternCache.java index c027587..84f62c5 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathSeparatorPatternCache.java +++ b/net-url/src/main/java/org/xbib/net/path/PathSeparatorPatternCache.java @@ -1,6 +1,7 @@ package org.xbib.net.path; /** + * Path separator pattern cache. */ class PathSeparatorPatternCache { diff --git a/net-url/src/main/java/org/xbib/net/path/PathStringMatcher.java b/net-url/src/main/java/org/xbib/net/path/PathStringMatcher.java index acb44ff..3335e7b 100644 --- a/net-url/src/main/java/org/xbib/net/path/PathStringMatcher.java +++ b/net-url/src/main/java/org/xbib/net/path/PathStringMatcher.java @@ -8,6 +8,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** + * Path string matcher. */ class PathStringMatcher { diff --git a/net-url/src/main/java/org/xbib/net/scheme/DefaultScheme.java b/net-url/src/main/java/org/xbib/net/scheme/DefaultScheme.java index cfb75dc..65a875a 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/DefaultScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/DefaultScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Default scheme. */ public class DefaultScheme extends AbstractScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/FileScheme.java b/net-url/src/main/java/org/xbib/net/scheme/FileScheme.java index ae5ffef..73f17de 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/FileScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/FileScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * File scheme. */ class FileScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/FtpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/FtpScheme.java index 2fb46db..b280504 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/FtpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/FtpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * FTP scheme. */ class FtpScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/GitScheme.java b/net-url/src/main/java/org/xbib/net/scheme/GitScheme.java index eb8bb85..40777c5 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/GitScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/GitScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Git scheme. */ class GitScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java index 829512e..75417d6 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Git secure scheme. */ class GitSecureHttpScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/GopherScheme.java b/net-url/src/main/java/org/xbib/net/scheme/GopherScheme.java index 797b372..e60ebd7 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/GopherScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/GopherScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Gopher scheme. */ class GopherScheme extends AbstractScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/HttpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/HttpScheme.java index 5a70002..42320a8 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/HttpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/HttpScheme.java @@ -4,7 +4,7 @@ import org.xbib.net.URL; import org.xbib.net.path.PathNormalizer; /** - * + * HTTP scheme. */ class HttpScheme extends AbstractScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/RedisScheme.java b/net-url/src/main/java/org/xbib/net/scheme/RedisScheme.java index cd53057..916d8a1 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/RedisScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/RedisScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Redis scheme. */ class RedisScheme extends AbstractScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/RsyncScheme.java b/net-url/src/main/java/org/xbib/net/scheme/RsyncScheme.java index ea20944..3aa6be0 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/RsyncScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/RsyncScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Rsync scheme. */ class RsyncScheme extends SshScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/RtmpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/RtmpScheme.java index 3fce1d8..7860df6 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/RtmpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/RtmpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Rtmp scheme. */ class RtmpScheme extends AbstractScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java index d3f323b..a87dfe6 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Secure HTTP scheme. */ class SecureHttpScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureImapScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureImapScheme.java index 8b2a0c2..e3eb80c 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureImapScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureImapScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * The IMAP scheme. + * The secure IMAP scheme. * @see IMAP scheme RFC */ class SecureImapScheme extends ImapScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java index 39398da..bc90cfd 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * The LDAPS scheme. + * The secure LDAP scheme. * * @see LDAP RFC */ diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java index a842a94..dda8e41 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * The snews scheme. + * The secure news scheme. * * @see news RFC */ diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java index d8f732a..bea7185 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * The POP3S scheme. + * The secure POP3 scheme. * * @see POP3 RFC */ diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java index f4959cb..fc6d38f 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * The SMTPS scheme. + * The secure SMTP scheme. * * @see SMTP RFC */ diff --git a/net-url/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java index 28fae29..09eb0b5 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Secure web socket scheme. */ class SecureWebSocketScheme extends WebSocketScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java index 5777767..9233336 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Secure FTP scheme. */ class SftpScheme extends SshScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/SshScheme.java b/net-url/src/main/java/org/xbib/net/scheme/SshScheme.java index e3adc8d..2736049 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/SshScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/SshScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Secure shell scheme. */ class SshScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/scheme/WebSocketScheme.java b/net-url/src/main/java/org/xbib/net/scheme/WebSocketScheme.java index 87b0b31..5b996de 100644 --- a/net-url/src/main/java/org/xbib/net/scheme/WebSocketScheme.java +++ b/net-url/src/main/java/org/xbib/net/scheme/WebSocketScheme.java @@ -1,7 +1,7 @@ package org.xbib.net.scheme; /** - * + * Web socket scheme. */ class WebSocketScheme extends HttpScheme { diff --git a/net-url/src/main/java/org/xbib/net/template/URITemplate.java b/net-url/src/main/java/org/xbib/net/template/URITemplate.java index 34166d0..d2f0c82 100644 --- a/net-url/src/main/java/org/xbib/net/template/URITemplate.java +++ b/net-url/src/main/java/org/xbib/net/template/URITemplate.java @@ -8,7 +8,7 @@ import org.xbib.net.template.vars.Variables; import java.util.List; /** - * + * URI templates. */ public class URITemplate { diff --git a/net-url/src/main/java/org/xbib/net/template/expression/ExpressionType.java b/net-url/src/main/java/org/xbib/net/template/expression/ExpressionType.java index 31aa1ac..25cca6f 100644 --- a/net-url/src/main/java/org/xbib/net/template/expression/ExpressionType.java +++ b/net-url/src/main/java/org/xbib/net/template/expression/ExpressionType.java @@ -1,6 +1,7 @@ package org.xbib.net.template.expression; /** + * Expression types. */ public enum ExpressionType { /* diff --git a/net-url/src/main/java/org/xbib/net/template/expression/TemplateExpression.java b/net-url/src/main/java/org/xbib/net/template/expression/TemplateExpression.java index 06ee71e..2b63c1a 100644 --- a/net-url/src/main/java/org/xbib/net/template/expression/TemplateExpression.java +++ b/net-url/src/main/java/org/xbib/net/template/expression/TemplateExpression.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.List; /** + * Template expression. */ public class TemplateExpression implements URITemplateExpression { diff --git a/net-url/src/main/java/org/xbib/net/template/expression/TemplateLiteral.java b/net-url/src/main/java/org/xbib/net/template/expression/TemplateLiteral.java index 4012759..35135b1 100644 --- a/net-url/src/main/java/org/xbib/net/template/expression/TemplateLiteral.java +++ b/net-url/src/main/java/org/xbib/net/template/expression/TemplateLiteral.java @@ -3,6 +3,7 @@ package org.xbib.net.template.expression; import org.xbib.net.template.vars.Variables; /** + * Template literal. */ public class TemplateLiteral implements URITemplateExpression { diff --git a/net-url/src/main/java/org/xbib/net/template/expression/URITemplateExpression.java b/net-url/src/main/java/org/xbib/net/template/expression/URITemplateExpression.java index c829b8d..0cc2ff5 100644 --- a/net-url/src/main/java/org/xbib/net/template/expression/URITemplateExpression.java +++ b/net-url/src/main/java/org/xbib/net/template/expression/URITemplateExpression.java @@ -3,6 +3,7 @@ package org.xbib.net.template.expression; import org.xbib.net.template.vars.Variables; /** + * Template expression interface. */ public interface URITemplateExpression { diff --git a/net-url/src/main/java/org/xbib/net/template/parse/ExpressionParser.java b/net-url/src/main/java/org/xbib/net/template/parse/ExpressionParser.java index 4fa2b93..e530439 100644 --- a/net-url/src/main/java/org/xbib/net/template/parse/ExpressionParser.java +++ b/net-url/src/main/java/org/xbib/net/template/parse/ExpressionParser.java @@ -13,6 +13,7 @@ import java.util.List; import java.util.Map; /** + * Expression parser. */ public class ExpressionParser implements TemplateParser { diff --git a/net-url/src/main/java/org/xbib/net/template/parse/LiteralParser.java b/net-url/src/main/java/org/xbib/net/template/parse/LiteralParser.java index a583c17..8b76d6c 100644 --- a/net-url/src/main/java/org/xbib/net/template/parse/LiteralParser.java +++ b/net-url/src/main/java/org/xbib/net/template/parse/LiteralParser.java @@ -7,6 +7,7 @@ import org.xbib.net.template.expression.URITemplateExpression; import java.nio.CharBuffer; /** + * Literal parser. */ public class LiteralParser implements TemplateParser { diff --git a/net-url/src/main/java/org/xbib/net/template/parse/TemplateParser.java b/net-url/src/main/java/org/xbib/net/template/parse/TemplateParser.java index ebd8cc7..ccaa1a1 100644 --- a/net-url/src/main/java/org/xbib/net/template/parse/TemplateParser.java +++ b/net-url/src/main/java/org/xbib/net/template/parse/TemplateParser.java @@ -5,7 +5,7 @@ import org.xbib.net.template.expression.URITemplateExpression; import java.nio.CharBuffer; /** - * + * Template parser interface. */ public interface TemplateParser { URITemplateExpression parse(CharBuffer buffer); diff --git a/net-url/src/main/java/org/xbib/net/template/parse/URITemplateParser.java b/net-url/src/main/java/org/xbib/net/template/parse/URITemplateParser.java index 6401e3c..7423b5b 100644 --- a/net-url/src/main/java/org/xbib/net/template/parse/URITemplateParser.java +++ b/net-url/src/main/java/org/xbib/net/template/parse/URITemplateParser.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.List; /** + * URI template parser. */ public class URITemplateParser { diff --git a/net-url/src/main/java/org/xbib/net/template/parse/VariableSpecParser.java b/net-url/src/main/java/org/xbib/net/template/parse/VariableSpecParser.java index 5777cf8..e050bb1 100644 --- a/net-url/src/main/java/org/xbib/net/template/parse/VariableSpecParser.java +++ b/net-url/src/main/java/org/xbib/net/template/parse/VariableSpecParser.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.List; /** + * Variable spec parser. */ public class VariableSpecParser { diff --git a/net-url/src/main/java/org/xbib/net/template/render/ListRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/ListRenderer.java index 1c54f4a..c161959 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/ListRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/ListRenderer.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.stream.Collectors; /** - * + * Liste renderer. */ public class ListRenderer extends MultiValueRenderer { diff --git a/net-url/src/main/java/org/xbib/net/template/render/MapRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/MapRenderer.java index cb4ccb8..4b1080e 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/MapRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/MapRenderer.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.stream.Collectors; /** - * + * Map renderer. */ public class MapRenderer extends MultiValueRenderer { diff --git a/net-url/src/main/java/org/xbib/net/template/render/MultiValueRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/MultiValueRenderer.java index 4b12280..6bf0dca 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/MultiValueRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/MultiValueRenderer.java @@ -7,7 +7,7 @@ import org.xbib.net.template.vars.values.VariableValue; import java.util.List; /** - * + * Multi value renderer. */ abstract class MultiValueRenderer extends ValueRenderer { diff --git a/net-url/src/main/java/org/xbib/net/template/render/NullRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/NullRenderer.java index 591e15b..181c76d 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/NullRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/NullRenderer.java @@ -7,7 +7,7 @@ import org.xbib.net.template.vars.values.VariableValue; import java.util.List; /** - * + * Null renderer. */ public class NullRenderer extends ValueRenderer { diff --git a/net-url/src/main/java/org/xbib/net/template/render/StringRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/StringRenderer.java index 9df4dca..4fa9d69 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/StringRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/StringRenderer.java @@ -8,7 +8,7 @@ import java.util.Collections; import java.util.List; /** - * + * String renderer. */ public class StringRenderer extends ValueRenderer { diff --git a/net-url/src/main/java/org/xbib/net/template/render/ValueRenderer.java b/net-url/src/main/java/org/xbib/net/template/render/ValueRenderer.java index c4b3c87..2e5fa43 100644 --- a/net-url/src/main/java/org/xbib/net/template/render/ValueRenderer.java +++ b/net-url/src/main/java/org/xbib/net/template/render/ValueRenderer.java @@ -78,4 +78,3 @@ public abstract class ValueRenderer { } } } - diff --git a/net-url/src/main/java/org/xbib/net/template/vars/Variables.java b/net-url/src/main/java/org/xbib/net/template/vars/Variables.java index c3bb5e2..af68a9c 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/Variables.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/Variables.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; /** + * Variables. */ public class Variables { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/specs/ExplodedVariable.java b/net-url/src/main/java/org/xbib/net/template/vars/specs/ExplodedVariable.java index 776d4aa..a7443f7 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/specs/ExplodedVariable.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/specs/ExplodedVariable.java @@ -1,7 +1,7 @@ package org.xbib.net.template.vars.specs; /** - * + * Exploded variable. */ public class ExplodedVariable extends VariableSpec { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/ListValue.java b/net-url/src/main/java/org/xbib/net/template/vars/values/ListValue.java index efa597f..bb4f770 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/ListValue.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/ListValue.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; /** - * + * List value. */ public class ListValue extends VariableValue { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/MapValue.java b/net-url/src/main/java/org/xbib/net/template/vars/values/MapValue.java index 85c44f6..12c9f03 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/MapValue.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/MapValue.java @@ -4,7 +4,7 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * + * Map value. */ public class MapValue extends VariableValue { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/NullValue.java b/net-url/src/main/java/org/xbib/net/template/vars/values/NullValue.java index 0f8632d..059fd92 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/NullValue.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/NullValue.java @@ -1,6 +1,7 @@ package org.xbib.net.template.vars.values; /** + * Null value. */ public class NullValue extends VariableValue { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/ScalarValue.java b/net-url/src/main/java/org/xbib/net/template/vars/values/ScalarValue.java index 41291fa..56938e2 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/ScalarValue.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/ScalarValue.java @@ -1,7 +1,7 @@ package org.xbib.net.template.vars.values; /** - * + * Scalar value. */ public class ScalarValue extends VariableValue { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/ValueType.java b/net-url/src/main/java/org/xbib/net/template/vars/values/ValueType.java index 5265eef..dbff65c 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/ValueType.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/ValueType.java @@ -8,6 +8,7 @@ import org.xbib.net.template.render.StringRenderer; import org.xbib.net.template.render.ValueRenderer; /** + * Value types. */ public enum ValueType { diff --git a/net-url/src/main/java/org/xbib/net/template/vars/values/VariableValue.java b/net-url/src/main/java/org/xbib/net/template/vars/values/VariableValue.java index 1e21db5..ad17a6b 100644 --- a/net-url/src/main/java/org/xbib/net/template/vars/values/VariableValue.java +++ b/net-url/src/main/java/org/xbib/net/template/vars/values/VariableValue.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; /** + * Variable value. */ public abstract class VariableValue { diff --git a/net-url/src/test/java/org/xbib/net/IRITest.java b/net-url/src/test/java/org/xbib/net/IRITest.java index 00cd9af..14554ee 100644 --- a/net-url/src/test/java/org/xbib/net/IRITest.java +++ b/net-url/src/test/java/org/xbib/net/IRITest.java @@ -29,7 +29,7 @@ public class IRITest { @Test public void testIpv6Invalid() { URL iri = URL.from("http://[2001:0db8:85a3:08d3:1319:8a2e:0370:734o]"); - assertEquals(URL.INVALID, iri); + assertEquals(URL.getInvalid(), iri); } @Test 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 08705ae..f677651 100644 --- a/net-url/src/test/java/org/xbib/net/URLParserTest.java +++ b/net-url/src/test/java/org/xbib/net/URLParserTest.java @@ -6,7 +6,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; /** * @@ -15,17 +14,17 @@ public class URLParserTest { @Test public void testNull() { - assertEquals(URL.INVALID, URL.from(null)); + assertEquals(URL.getInvalid(), URL.from(null)); } @Test public void testEmpty() { - assertEquals(URL.INVALID, URL.from("")); + assertEquals(URL.getInvalid(), URL.from("")); } @Test public void testNewline() { - assertEquals(URL.INVALID, URL.from("\n")); + assertEquals(URL.getInvalid(), URL.from("\n")); } @Test(expected = IllegalArgumentException.class) diff --git a/net-url/src/test/java/org/xbib/net/URLResolverTest.java b/net-url/src/test/java/org/xbib/net/URLResolverTest.java index 9c33b8b..4a9e76b 100644 --- a/net-url/src/test/java/org/xbib/net/URLResolverTest.java +++ b/net-url/src/test/java/org/xbib/net/URLResolverTest.java @@ -94,9 +94,11 @@ public class URLResolverTest { // scheme resolve("http://a/b/c/d;p?q", "http:g", "http:g"); resolve("http://a/b/c/d;p?q", "http:", "http:"); + // absolute + resolve("http://a/b/c/d;p?q", "http://e/f/g/h", "http://e/f/g/h"); } - private void resolve(String inputBase, String relative, String expected) throws URLSyntaxException { - assertEquals(expected, URL.base(inputBase).resolve(relative).toExternalForm()); + private void resolve(String inputBase, String spec, String expected) throws URLSyntaxException { + assertEquals(expected, URL.base(inputBase).resolve(spec).toExternalForm()); } }