svn commit: r1842290 - in /commons/proper/codec/trunk/src: changes/changes.xml main/java/org/apache/commons/codec/language/ColognePhonetic.java test/java/org/apache/commons/codec/language/ColognePhone
Author: sebb Date: Fri Sep 28 22:47:42 2018 New Revision: 1842290 URL: http://svn.apache.org/viewvc?rev=1842290=rev Log: CODEC-250 Wrong value calculated by Cologne Phonetic if a special character is placed between equal letters Modified: commons/proper/codec/trunk/src/changes/changes.xml commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Modified: commons/proper/codec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/changes/changes.xml?rev=1842290=1842289=1842290=diff == --- commons/proper/codec/trunk/src/changes/changes.xml (original) +++ commons/proper/codec/trunk/src/changes/changes.xml Fri Sep 28 22:47:42 2018 @@ -44,6 +44,7 @@ The type attribute can be add,u + Wrong value calculated by Cologne Phonetic if a special character is placed between equal letters Update from Java 6 to Java 7 Add Percent-Encoding Codec (described in RFC3986 and RFC7578) ColognePhoneticTest.testIsEncodeEquals missing assertions Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1842290=1842289=1842290=diff == --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Fri Sep 28 22:47:42 2018 @@ -337,13 +337,13 @@ public class ColognePhonetic implements nextChar = CHAR_IGNORE; } +// OK to ignore H here because it only affects nextChar which has already been set up +if (chr == 'H' || chr < 'A' || chr > 'Z') { +continue; // ignore unwanted characters +} + if (arrayContains(AEIJOUY, chr)) { code = '0'; -} else if (chr == 'H' || chr < 'A' || chr > 'Z') { -if (lastCode == CHAR_FIRST_POS) { -continue; // ignore leading unwanted characters -} -code = CHAR_IGNORE; } else if (chr == 'B' || (chr == 'P' && nextChar != 'H')) { code = '1'; } else if ((chr == 'D' || chr == 'T') && !arrayContains(SCZ, nextChar)) { @@ -380,7 +380,7 @@ public class ColognePhonetic implements } else if (chr == 'M' || chr == 'N') { code = '6'; } else { -code = chr; +code = chr; // should not happen? } if (code != CHAR_IGNORE && (lastCode != code && (code != '0' || lastCode == CHAR_FIRST_POS) || code < '0' || code > '8')) { Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1842290=1842289=1842290=diff == --- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java (original) +++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Fri Sep 28 22:47:42 2018 @@ -235,6 +235,12 @@ public class ColognePhoneticTest extends this.checkEncodingVariations("67", data); } +@Test +public void testSpecialCharsBetweenSameLetters() throws EncoderException { +final String data[] = {"Test test", "Testtest", "Test-test", "TesT#Test", "TesT?test"}; +this.checkEncodingVariations("28282", data); +} + // Allow command-line testing public static void main(String args[]) { ColognePhonetic coder = new ColognePhonetic();
svn commit: r1842289 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
Author: sebb Date: Fri Sep 28 22:37:03 2018 New Revision: 1842289 URL: http://svn.apache.org/viewvc?rev=1842289=rev Log: Drop accidental debug commit Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1842289=1842288=1842289=diff == --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Fri Sep 28 22:37:03 2018 @@ -381,7 +381,6 @@ public class ColognePhonetic implements code = '6'; } else { code = chr; -throw new RuntimeException(); } if (code != CHAR_IGNORE && (lastCode != code && (code != '0' || lastCode == CHAR_FIRST_POS) || code < '0' || code > '8')) {
svn commit: r1842287 - /commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java
Author: sebb Date: Fri Sep 28 22:28:20 2018 New Revision: 1842287 URL: http://svn.apache.org/viewvc?rev=1842287=rev Log: Test characters above Z Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1842287=1842286=1842287=diff == --- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java (original) +++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Fri Sep 28 22:28:20 2018 @@ -154,6 +154,7 @@ public class ColognePhoneticTest extends {"cl", "45"}, {"acl", "085"}, {"mn", "6"}, +{"{mn}","6"}, // test chars above Z {"r", "7"}}; this.checkEncodings(data); }
svn commit: r1842286 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
Author: sebb Date: Fri Sep 28 22:23:19 2018 New Revision: 1842286 URL: http://svn.apache.org/viewvc?rev=1842286=rev Log: Fix up spurious space in Javadoc output Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1842286=1842285=1842286=diff == --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Fri Sep 28 22:23:19 2018 @@ -151,8 +151,8 @@ import org.apache.commons.codec.StringEn * * Example: * - * "Mller-L - * denscheidt" = "MULLERLUDENSCHEIDT" = "6005507500206880022" + * "Mller-Ldenscheidt" + * = "MULLERLUDENSCHEIDT" = "6005507500206880022" * * *
svn commit: r1842284 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java
Author: sebb Date: Fri Sep 28 21:28:41 2018 New Revision: 1842284 URL: http://svn.apache.org/viewvc?rev=1842284=rev Log: Javadoc Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java?rev=1842284=1842283=1842284=diff == --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/PercentCodec.java Fri Sep 28 21:28:41 2018 @@ -230,7 +230,7 @@ public class PercentCodec implements Bin * * @param obj the object to encode * @return the encoding result byte[] as Object - * @throws EncoderException + * @throws EncoderException if the object is not a byte array */ @Override public Object encode(final Object obj) throws EncoderException { @@ -248,7 +248,7 @@ public class PercentCodec implements Bin * * @param obj the object to decode * @return the decoding result byte[] as Object - * @throws DecoderException + * @throws DecoderException if the object is not a byte array */ @Override public Object decode(final Object obj) throws DecoderException {
Nexus: Staging Completed
Message from: https://repository.apache.orgDescription:commons-text-1.5-RC1Deployer properties:"userAgent" = "Apache-Maven/3.5.4 (Java 10.0.2; Mac OS X 10.14)""userId" = "chtompki""ip" = "199.244.219.39"Details:The following artifacts have been staged/org/apache/commons/commons-text/1.5/commons-text-1.5.pom(SHA1: 82df3464f1d6b7b99eb6cc92069739a6234c9710)/org/apache/commons/commons-text/1.5/commons-text-1.5.pom.asc(SHA1: f8465aece5b0c69352fa0fbab05238c53036ac32)/org/apache/commons/commons-text/1.5/commons-text-1.5-sources.jar(SHA1: 3e39eac3b213fe33e2b60eb4322cb44f7d7a1680)/org/apache/commons/commons-text/1.5/commons-text-1.5.jar(SHA1: 9fdbd9e3d4507ef6640fb762f1e0e27c0fabbfe2)/org/apache/commons/commons-text/1.5/commons-text-1.5-sources.jar.asc(SHA1: d6e0b311cae1ac428852dfa114af6b205517f00e)/org/apache/commons/commons-text/1.5/commons-text-1.5.jar.asc(SHA1: 6e0617b3f5f7fdc6dca226ba7dfc970be74848fb)/org/apache/commons/commons-text/1.5/commons-text-1.5-tests.jar(SHA1: 142ea354f65e5db0ae291d2eec8a2100defd45af)/org/apache/commons/commons-text/1.5/commons-text-1.5-test-sources.jar.asc(SHA1: dda03692cc2ef54df86a84bc351b4c9249974092)/org/apache/commons/commons-text/1.5/commons-text-1.5-test-sources.jar(SHA1: e60a4ce76ff8f91ae034340c11fc2e01e332f644)/org/apache/commons/commons-text/1.5/commons-text-1.5-javadoc.jar.asc(SHA1: b93f915a0ed7a3dea5f96d0af1c70167fbeaa911)/org/apache/commons/commons-text/1.5/commons-text-1.5-javadoc.jar(SHA1: c3d0e95dc0d2971ccc50fd9b92a54ff78d92338a)/org/apache/commons/commons-text/1.5/commons-text-1.5-tests.jar.asc(SHA1: c1544ec83338bf6c30b9646e510a7a5f7e5a4181)Action performed by Rob Tompkins (chtompki)
svn commit: r29768 - in /dev/commons/text/1.5-RC1: ./ binaries/ site/ site/apidocs/ site/apidocs/jquery/ site/apidocs/jquery/external/ site/apidocs/jquery/external/jquery/ site/apidocs/jquery/images/
Author: chtompki Date: Fri Sep 28 18:24:52 2018 New Revision: 29768 Log: Staging commons-text-1.5-RC1 [This commit notification would consist of 182 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
[commons-text] Git Push Summary
Repository: commons-text Updated Tags: refs/tags/commons-text-1.5-RC1 [created] 5b32504f5
[text] \n -> %n for spotbugs
Repository: commons-text Updated Branches: refs/heads/master b8af65358 -> 96651f6f3 \n -> %n for spotbugs Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/96651f6f Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/96651f6f Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/96651f6f Branch: refs/heads/master Commit: 96651f6f30352fbe24b62a06f3641c5d67a67bb7 Parents: b8af653 Author: Rob Tompkins Authored: Fri Sep 28 14:09:56 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 14:09:56 2018 -0400 -- .../commons/text/lookup/JavaPlatformStringLookup.java | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/96651f6f/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java index 81ad40a..4402a66 100644 --- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java @@ -63,12 +63,12 @@ final class JavaPlatformStringLookup extends AbstractStringLookup { */ public static void main(String[] args) { System.out.println(JavaPlatformStringLookup.class); -System.out.printf("%s = %s\n", KEY_VERSION, JavaPlatformStringLookup.INSTANCE.lookup(KEY_VERSION)); -System.out.printf("%s = %s\n", KEY_RUNTIME, JavaPlatformStringLookup.INSTANCE.lookup(KEY_RUNTIME)); -System.out.printf("%s = %s\n", KEY_VM, JavaPlatformStringLookup.INSTANCE.lookup(KEY_VM)); -System.out.printf("%s = %s\n", KEY_OS, JavaPlatformStringLookup.INSTANCE.lookup(KEY_OS)); -System.out.printf("%s = %s\n", KEY_HARDWARE, JavaPlatformStringLookup.INSTANCE.lookup(KEY_HARDWARE)); -System.out.printf("%s = %s\n", KEY_LOCALE, JavaPlatformStringLookup.INSTANCE.lookup(KEY_LOCALE)); +System.out.printf("%s = %s%n", KEY_VERSION, JavaPlatformStringLookup.INSTANCE.lookup(KEY_VERSION)); +System.out.printf("%s = %s%n", KEY_RUNTIME, JavaPlatformStringLookup.INSTANCE.lookup(KEY_RUNTIME)); +System.out.printf("%s = %s%n", KEY_VM, JavaPlatformStringLookup.INSTANCE.lookup(KEY_VM)); +System.out.printf("%s = %s%n", KEY_OS, JavaPlatformStringLookup.INSTANCE.lookup(KEY_OS)); +System.out.printf("%s = %s%n", KEY_HARDWARE, JavaPlatformStringLookup.INSTANCE.lookup(KEY_HARDWARE)); +System.out.printf("%s = %s%n", KEY_LOCALE, JavaPlatformStringLookup.INSTANCE.lookup(KEY_LOCALE)); } /**
svn commit: r1842273 - in /commons/proper/commons-parent/trunk: pom.xml src/changes/changes.xml
Author: chtompki Date: Fri Sep 28 17:38:13 2018 New Revision: 1842273 URL: http://svn.apache.org/viewvc?rev=1842273=rev Log: commons.spotbugs.version: 3.1.3 -> 3.1.6 Modified: commons/proper/commons-parent/trunk/pom.xml commons/proper/commons-parent/trunk/src/changes/changes.xml Modified: commons/proper/commons-parent/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/commons-parent/trunk/pom.xml?rev=1842273=1842272=1842273=diff == --- commons/proper/commons-parent/trunk/pom.xml (original) +++ commons/proper/commons-parent/trunk/pom.xml Fri Sep 28 17:38:13 2018 @@ -1673,7 +1673,7 @@ 3.8.0 1.1 3.0.5 -3.1.3 +3.1.6 3.5.1 3.0.0 1.16 Modified: commons/proper/commons-parent/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/commons-parent/trunk/src/changes/changes.xml?rev=1842273=1842272=1842273=diff == --- commons/proper/commons-parent/trunk/src/changes/changes.xml (original) +++ commons/proper/commons-parent/trunk/src/changes/changes.xml Fri Sep 28 17:38:13 2018 @@ -62,6 +62,7 @@ The type attribute can be add,u +commons.spotbugs.version: 3.1.3 -> 3.1.6 japicmp-maven-plugin: 0.12.0 -> 0.13.0 Revert change in commons.scmPubUrl in Parent 47 Update parent from org.apache:apache 19 to 20.
svn commit: r1842272 - in /commons/proper/commons-parent/trunk: pom.xml src/changes/changes.xml
Author: chtompki Date: Fri Sep 28 17:36:52 2018 New Revision: 1842272 URL: http://svn.apache.org/viewvc?rev=1842272=rev Log: japicmp-maven-plugin: 0.12.0 -> 0.13.0, in changes.xml Modified: commons/proper/commons-parent/trunk/pom.xml commons/proper/commons-parent/trunk/src/changes/changes.xml Modified: commons/proper/commons-parent/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/commons-parent/trunk/pom.xml?rev=1842272=1842271=1842272=diff == --- commons/proper/commons-parent/trunk/pom.xml (original) +++ commons/proper/commons-parent/trunk/pom.xml Fri Sep 28 17:36:52 2018 @@ -1624,7 +1624,7 @@ 0.12 2.12.1 2.8 -0.12.0 +0.13.0 2.5 3.0.0 3.1.0 Modified: commons/proper/commons-parent/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/commons-parent/trunk/src/changes/changes.xml?rev=1842272=1842271=1842272=diff == --- commons/proper/commons-parent/trunk/src/changes/changes.xml (original) +++ commons/proper/commons-parent/trunk/src/changes/changes.xml Fri Sep 28 17:36:52 2018 @@ -62,6 +62,7 @@ The type attribute can be add,u +japicmp-maven-plugin: 0.12.0 -> 0.13.0 Revert change in commons.scmPubUrl in Parent 47 Update parent from org.apache:apache 19 to 20. maven-compiler-plugin 3.7.0 -> 3.8.0
[text] Minor upgrades to prepare to build release with java10
Repository: commons-text Updated Branches: refs/heads/master 561354228 -> b8af65358 Minor upgrades to prepare to build release with java10 Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/b8af6535 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/b8af6535 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/b8af6535 Branch: refs/heads/master Commit: b8af6535825c589bbb6d4280fcb75925c59a9eb3 Parents: 5613542 Author: Rob Tompkins Authored: Fri Sep 28 13:31:49 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 13:31:49 2018 -0400 -- pom.xml | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/b8af6535/pom.xml -- diff --git a/pom.xml b/pom.xml index 2b83a03..9823a56 100644 --- a/pom.xml +++ b/pom.xml @@ -52,14 +52,21 @@ 3.0.0 8.12 -3.1.5 +3.1.6 + + + false + +0.13.0 +false 1.4 +RC1 true scm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid} -Gary Gregory -86fdc7e2a11262cb +Rob Tompkins + B6E73D84EA4FCC47166087253FAAD2CD5ECBB314 @@ -119,7 +126,15 @@ src/site/resources/release-notes/RELEASE-NOTES-*.txt + + + com.github.siom79.japicmp + japicmp-maven-plugin + +false + +
[text] (fix) checkstyle nits...javadocs
Repository: commons-text Updated Branches: refs/heads/master 6872117ae -> 561354228 (fix) checkstyle nits...javadocs Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/56135422 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/56135422 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/56135422 Branch: refs/heads/master Commit: 5613542285d25c7ab7f77a39741605aee061 Parents: 6872117 Author: Rob Tompkins Authored: Fri Sep 28 13:05:16 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 13:05:16 2018 -0400 -- .../java/org/apache/commons/text/StringSubstitutor.java | 3 ++- .../commons/text/lookup/JavaPlatformStringLookup.java| 11 +++ .../commons/text/lookup/ResourceBundleStringLookup.java | 4 3 files changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/56135422/src/main/java/org/apache/commons/text/StringSubstitutor.java -- diff --git a/src/main/java/org/apache/commons/text/StringSubstitutor.java b/src/main/java/org/apache/commons/text/StringSubstitutor.java index 58f6e82..fbebd61 100644 --- a/src/main/java/org/apache/commons/text/StringSubstitutor.java +++ b/src/main/java/org/apache/commons/text/StringSubstitutor.java @@ -173,7 +173,8 @@ public class StringSubstitutor { /** * Constant for the default value delimiter of a variable. */ -public static final StringMatcher DEFAULT_VALUE_DELIMITER = StringMatcherFactory.INSTANCE.stringMatcher(DEFAULT_VAR_DEFAULT); +public static final StringMatcher DEFAULT_VALUE_DELIMITER = +StringMatcherFactory.INSTANCE.stringMatcher(DEFAULT_VAR_DEFAULT); // --- /** http://git-wip-us.apache.org/repos/asf/commons-text/blob/56135422/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java index 383c10a..81ad40a 100644 --- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java @@ -38,11 +38,17 @@ import org.apache.commons.lang3.StringUtils; */ final class JavaPlatformStringLookup extends AbstractStringLookup { +/** locale key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_LOCALE = "locale"; +/** hardware key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_HARDWARE = "hardware"; +/** os key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_OS = "os"; +/** vm key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_VM = "vm"; +/** runtime key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_RUNTIME = "runtime"; +/** version key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_VERSION = "version"; /** @@ -50,6 +56,11 @@ final class JavaPlatformStringLookup extends AbstractStringLookup { */ static final JavaPlatformStringLookup INSTANCE = new JavaPlatformStringLookup(); +/** + * The main method for running the JavaPlatformStringLookup. + * + * @param args the standard java main method parameter which is unused for our running of this class. + */ public static void main(String[] args) { System.out.println(JavaPlatformStringLookup.class); System.out.printf("%s = %s\n", KEY_VERSION, JavaPlatformStringLookup.INSTANCE.lookup(KEY_VERSION)); http://git-wip-us.apache.org/repos/asf/commons-text/blob/56135422/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java b/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java index 8a14c1b..876de18 100644 --- a/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java @@ -33,6 +33,9 @@ import java.util.ResourceBundle; */ final class ResourceBundleStringLookup extends AbstractStringLookup { +/** + * The name of the resource bundle from which to look something up. +
[2/4] [text] Fixed code formatting
Fixed code formatting Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/189f4210 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/189f4210 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/189f4210 Branch: refs/heads/master Commit: 189f421051f0e29789a8cdbac9dfa7d07f66ac2d Parents: 0d4c9c4 Author: nickwongwong Authored: Fri Sep 14 20:34:11 2018 +0800 Committer: nickwongwong Committed: Fri Sep 14 20:34:11 2018 +0800 -- .../org/apache/commons/text/lookup/AbstractStringLookup.java | 7 +++ .../org/apache/commons/text/lookup/ScriptStringLookup.java| 4 ++-- .../org/apache/commons/text/lookup/StringLookupFactory.java | 1 + .../java/org/apache/commons/text/lookup/UrlStringLookup.java | 5 +++-- src/test/resources/document.properties| 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/189f4210/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java b/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java index f265bf7..404bbdc 100644 --- a/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java @@ -24,7 +24,14 @@ package org.apache.commons.text.lookup; */ abstract class AbstractStringLookup implements StringLookup { +/** + * The default split char. + */ protected static final char SPLIT_CH = ':'; + +/** + * The default split string. + */ protected static final String SPLIT_STR = String.valueOf(SPLIT_CH); /** http://git-wip-us.apache.org/repos/asf/commons-text/blob/189f4210/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java b/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java index affb1a3..99f1be9 100644 --- a/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java @@ -78,8 +78,8 @@ final class ScriptStringLookup extends AbstractStringLookup { final Object eval = scriptEngine.eval(script); return Objects.toString(eval, null); } catch (final Exception e) { -throw IllegalArgumentExceptions.format(e, "Error looking up script engine [%s] for script [%s].", engineName, -script); +throw IllegalArgumentExceptions.format(e, "Error looking up script engine [%s] for script [%s].", +engineName, script); } } http://git-wip-us.apache.org/repos/asf/commons-text/blob/189f4210/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java index 73a4398..25f6596 100644 --- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java +++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java @@ -54,6 +54,7 @@ public final class StringLookupFactory { * * * @param stringLookupMap + *the map of string lookups. * @since 1.5 */ public void addDefaultStringLookups(final Map stringLookupMap) { http://git-wip-us.apache.org/repos/asf/commons-text/blob/189f4210/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java b/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java index e17e668..6e0d4d4 100644 --- a/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java @@ -72,8 +72,9 @@ final class UrlStringLookup extends AbstractStringLookup { final String urlStr = substringAfter(key, SPLIT_CH); try { final URL url = new URL(urlStr); -final StringWriter writer = new StringWriter(8192); -final char[] buffer = new char[8192]; +final int size = 8192; +final StringWriter writer = new StringWriter(size); +final char[] buffer = new char[size]; try (InputStreamReader reader = new InputStreamReader(new
[3/4] [text] Merge branch 'master' of https://github.com/nickwongwong/commons-text
Merge branch 'master' of https://github.com/nickwongwong/commons-text Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/9c7dff19 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/9c7dff19 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/9c7dff19 Branch: refs/heads/master Commit: 9c7dff199a3ccd84f817b0ad8a76659cb26fd16a Parents: 8ae4ff0 189f421 Author: Rob Tompkins Authored: Fri Sep 28 12:43:59 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 12:43:59 2018 -0400 -- .../text/lookup/AbstractStringLookup.java | 12 + .../commons/text/lookup/ScriptStringLookup.java | 4 +-- .../text/lookup/StringLookupFactory.java| 1 + .../commons/text/lookup/UrlStringLookup.java| 5 ++-- .../text/similarity/JaccardSimilarity.java | 27 src/test/resources/document.properties | 2 +- 6 files changed, 30 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/9c7dff19/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java -- diff --cc src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java index e3c44e9,404bbdc..4dbdb65 --- a/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/AbstractStringLookup.java @@@ -24,8 -24,14 +24,20 @@@ package org.apache.commons.text.lookup */ abstract class AbstractStringLookup implements StringLookup { ++ ++/** ++ * The empty string. ++ */ +private static final String EMPTY = ""; ++ + /** + * The default split char. + */ protected static final char SPLIT_CH = ':'; + + /** + * The default split string. + */ protected static final String SPLIT_STR = String.valueOf(SPLIT_CH); /** http://git-wip-us.apache.org/repos/asf/commons-text/blob/9c7dff19/src/main/java/org/apache/commons/text/lookup/ScriptStringLookup.java -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/9c7dff19/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/9c7dff19/src/main/java/org/apache/commons/text/lookup/UrlStringLookup.java --
[1/4] [text] [TEXT-139] Improve JaccardSimilarity computational cost.
Repository: commons-text Updated Branches: refs/heads/master 8ae4ff075 -> 6872117ae [TEXT-139] Improve JaccardSimilarity computational cost. Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0d4c9c45 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0d4c9c45 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0d4c9c45 Branch: refs/heads/master Commit: 0d4c9c4593fa98909c603fc701c8116975d8d8a8 Parents: 85465e2 Author: nickwongwong Authored: Mon Sep 10 22:01:46 2018 +0800 Committer: nickwongwong Committed: Mon Sep 10 22:01:46 2018 +0800 -- .../text/similarity/JaccardSimilarity.java | 27 1 file changed, 11 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/0d4c9c45/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java -- diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java index 1dc2b85..2e88dd2 100644 --- a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java +++ b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java @@ -62,27 +62,22 @@ public class JaccardSimilarity implements SimilarityScore { * @return index */ private Double calculateJaccardSimilarity(final CharSequence left, final CharSequence right) { -final Set intersectionSet = new HashSet<>(); -final Set unionSet = new HashSet<>(); -boolean unionFilled = false; final int leftLength = left.length(); final int rightLength = right.length(); if (leftLength == 0 || rightLength == 0) { return 0d; } - -for (int leftIndex = 0; leftIndex < leftLength; leftIndex++) { -unionSet.add(String.valueOf(left.charAt(leftIndex))); -for (int rightIndex = 0; rightIndex < rightLength; rightIndex++) { -if (!unionFilled) { -unionSet.add(String.valueOf(right.charAt(rightIndex))); -} -if (left.charAt(leftIndex) == right.charAt(rightIndex)) { - intersectionSet.add(String.valueOf(left.charAt(leftIndex))); -} -} -unionFilled = true; +final Set leftSet = new HashSet<>(); +for (int i = 0; i < leftLength; i++) { +leftSet.add(left.charAt(i)); +} +final Set rightSet = new HashSet<>(); +for (int i = 0; i < rightLength; i++) { +rightSet.add(right.charAt(i)); } -return Double.valueOf(intersectionSet.size()) / Double.valueOf(unionSet.size()); +final Set unionSet = new HashSet<>(leftSet); +unionSet.addAll(rightSet); +final int intersectionSize = leftSet.size() + rightSet.size() - unionSet.size(); +return 1.0d * intersectionSize / unionSet.size(); } }
[4/4] [text] TEXT-139: Thanks @nickwongwong
TEXT-139: Thanks @nickwongwong Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/6872117a Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/6872117a Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/6872117a Branch: refs/heads/master Commit: 6872117ae1d33450bf4be694b3a6af6772e006f2 Parents: 9c7dff1 Author: Rob Tompkins Authored: Fri Sep 28 12:45:58 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 12:45:58 2018 -0400 -- pom.xml | 3 +++ src/changes/changes.xml | 1 + 2 files changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/6872117a/pom.xml -- diff --git a/pom.xml b/pom.xml index f79cfd3..2b83a03 100644 --- a/pom.xml +++ b/pom.xml @@ -360,6 +360,9 @@ Nandor Kollar + + Nick Wong + http://git-wip-us.apache.org/repos/asf/commons-text/blob/6872117a/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 91d507d..43ead66 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove. +Improve JaccardSimilarity computational cost JSON escaping incorrect for the delete control character Fixes JaroWinklerDistance: Wrong results due to precision of transpositions JaroWinklerDistance: Calculation deviates from definition
[1/3] [text] TEXT-118: JSON escaping incorrect for the delete control character
Repository: commons-text Updated Branches: refs/heads/master 4baa89f03 -> 8ae4ff075 TEXT-118: JSON escaping incorrect for the delete control character Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/47aefa39 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/47aefa39 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/47aefa39 Branch: refs/heads/master Commit: 47aefa392ebe7e2ea777318b9c5d7f8b9d201b85 Parents: 1898b78 Author: Nandor Kollar Authored: Fri Sep 28 15:35:11 2018 +0200 Committer: Nandor Kollar Committed: Fri Sep 28 15:35:11 2018 +0200 -- src/main/java/org/apache/commons/text/StringEscapeUtils.java | 2 +- .../java/org/apache/commons/text/StringEscapeUtilsTest.java| 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/47aefa39/src/main/java/org/apache/commons/text/StringEscapeUtils.java -- diff --git a/src/main/java/org/apache/commons/text/StringEscapeUtils.java b/src/main/java/org/apache/commons/text/StringEscapeUtils.java index 3ac66ff..b183233 100644 --- a/src/main/java/org/apache/commons/text/StringEscapeUtils.java +++ b/src/main/java/org/apache/commons/text/StringEscapeUtils.java @@ -108,7 +108,7 @@ public class StringEscapeUtils { ESCAPE_JSON = new AggregateTranslator( new LookupTranslator(Collections.unmodifiableMap(escapeJsonMap)), new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE), -JavaUnicodeEscaper.outsideOf(32, 0x7f) +JavaUnicodeEscaper.outsideOf(32, 0x7e) ); } http://git-wip-us.apache.org/repos/asf/commons-text/blob/47aefa39/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java index 2d36c13..e9abe7b 100644 --- a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java @@ -633,4 +633,10 @@ public class StringEscapeUtilsTest { assertEquals(jsonString, StringEscapeUtils.unescapeJson(escapedJsonString)); } + +@Test +public void testDeleteCharacter() { + String deleteString = "Delete: \u007F"; + assertEquals("Delete: \\u007F", StringEscapeUtils.escapeJson(deleteString)); +} }
[2/3] [text] Merge branch 'TEXT-118' of https://github.com/nandorKollar/commons-text
Merge branch 'TEXT-118' of https://github.com/nandorKollar/commons-text Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/addaa697 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/addaa697 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/addaa697 Branch: refs/heads/master Commit: addaa697aac9233f5ae01e3b509a0f48db6d397d Parents: 4baa89f 47aefa3 Author: Rob Tompkins Authored: Fri Sep 28 12:10:18 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 12:10:18 2018 -0400 -- src/main/java/org/apache/commons/text/StringEscapeUtils.java | 2 +- .../java/org/apache/commons/text/StringEscapeUtilsTest.java| 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) --
[3/3] [text] TEXT-118: thanks @nandorKollar
TEXT-118: thanks @nandorKollar Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/8ae4ff07 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/8ae4ff07 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/8ae4ff07 Branch: refs/heads/master Commit: 8ae4ff0755a59b48713cfde2c12929230799008b Parents: addaa69 Author: Rob Tompkins Authored: Fri Sep 28 12:35:56 2018 -0400 Committer: Rob Tompkins Committed: Fri Sep 28 12:35:56 2018 -0400 -- pom.xml | 3 +++ src/changes/changes.xml | 1 + 2 files changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/8ae4ff07/pom.xml -- diff --git a/pom.xml b/pom.xml index 49ab80e..f79cfd3 100644 --- a/pom.xml +++ b/pom.xml @@ -357,6 +357,9 @@ Jan Martin Keil + + Nandor Kollar + http://git-wip-us.apache.org/repos/asf/commons-text/blob/8ae4ff07/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index dce92bd..91d507d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove. +JSON escaping incorrect for the delete control character Fixes JaroWinklerDistance: Wrong results due to precision of transpositions JaroWinklerDistance: Calculation deviates from definition Update Apache Commons Lang from 3.7 to 3.8.1
svn commit: r1842269 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
Author: ggregory Date: Fri Sep 28 16:28:34 2018 New Revision: 1842269 URL: http://svn.apache.org/viewvc?rev=1842269=rev Log: Remove useless parens. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java?rev=1842269=1842268=1842269=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java Fri Sep 28 16:28:34 2018 @@ -752,7 +752,7 @@ public abstract class AbstractConfigurat protected String interpolate(final String base) { final Object result = interpolate((Object) base); -return (result == null) ? null : result.toString(); +return result == null ? null : result.toString(); } /**
svn commit: r1842268 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java
Author: ggregory Date: Fri Sep 28 16:25:25 2018 New Revision: 1842268 URL: http://svn.apache.org/viewvc?rev=1842268=rev Log: Remove useless parens. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java?rev=1842268=1842267=1842268=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java Fri Sep 28 16:25:25 2018 @@ -571,7 +571,7 @@ public class XMLBeanDeclaration implemen private String getAttribute(final NodeData nd, final String attr) { final Object value = nd.getAttribute(attr); -return (value == null) ? null : String.valueOf(interpolate(value)); +return value == null ? null : String.valueOf(interpolate(value)); } /**
svn commit: r1842261 - in /commons/proper/configuration/trunk/src: changes/ main/java/org/apache/commons/configuration2/interpol/ test/java/org/apache/commons/configuration2/
Author: ggregory Date: Fri Sep 28 15:43:43 2018 New Revision: 1842261 URL: http://svn.apache.org/viewvc?rev=1842261=rev Log: [CONFIGURATION-724] Add support for Commons Text 1.4 localhost string lookup as a default lookup. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java Modified: commons/proper/configuration/trunk/src/changes/changes.xml commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/InterpolationTestHelper.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestAbstractHierarchicalConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestBaseConfiguration.java Modified: commons/proper/configuration/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1842261=1842260=1842261=diff == --- commons/proper/configuration/trunk/src/changes/changes.xml (original) +++ commons/proper/configuration/trunk/src/changes/changes.xml Fri Sep 28 15:43:43 2018 @@ -59,6 +59,9 @@ Update optional Spring dependencies from 4.3.18.RELEASE to 4.3.19.RELEASE. + +Add support for Commons Text 1.4 localhost string lookup as a default lookup. + http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java?rev=1842261=1842260=1842261=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java Fri Sep 28 15:43:43 2018 @@ -16,6 +16,8 @@ */ package org.apache.commons.configuration2.interpol; +import org.apache.commons.text.lookup.StringLookupFactory; + /** * * An enumeration class defining constants for the {@code Lookup} objects @@ -37,6 +39,9 @@ package org.apache.commons.configuration */ public enum DefaultLookups { +/** @since 2.4 */ +LOCAL_HOST("localhost", new StringLookupAdapter(StringLookupFactory.INSTANCE.localHostStringLookup())), + /** The lookup for system properties. */ SYSTEM_PROPERTIES("sys", new SystemPropertiesLookup()), @@ -70,8 +75,7 @@ public enum DefaultLookups * * @return the prefix */ -public String getPrefix() -{ +public String getPrefix() { return prefix; } @@ -80,8 +84,7 @@ public enum DefaultLookups * * @return the associated {@code Lookup} object */ -public Lookup getLookup() -{ +public Lookup getLookup() { return lookup; } } Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java?rev=1842261=auto == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java (added) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java Fri Sep 28 15:43:43 2018 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.commons.configuration2.interpol; + +import java.util.Objects; + +import org.apache.commons.text.lookup.StringLookup; + +/** + * Wraps an Apache Commons Text {@link StringLookup} as an Apache Commons Configuration {@link Lookup}. + * + * @since 2.4 + */ +class StringLookupAdapter implements Lookup { + +private final StringLookup stringLookup; + +StringLookupAdapter(StringLookup
[text] Remove trailing white spaces.
Repository: commons-text Updated Branches: refs/heads/master 5d01c5966 -> 4baa89f03 Remove trailing white spaces. Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/4baa89f0 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/4baa89f0 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/4baa89f0 Branch: refs/heads/master Commit: 4baa89f0348b66323ddea8b30ca4886bc3a82c87 Parents: 5d01c59 Author: Gary Gregory Authored: Fri Sep 28 09:24:46 2018 -0600 Committer: Gary Gregory Committed: Fri Sep 28 09:24:46 2018 -0600 -- src/main/java/org/apache/commons/text/StringSubstitutor.java | 6 +++--- .../apache/commons/text/lookup/JavaPlatformStringLookup.java | 2 +- .../apache/commons/text/lookup/ResourceBundleStringLookup.java | 2 +- .../org/apache/commons/text/lookup/StringLookupFactory.java| 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/4baa89f0/src/main/java/org/apache/commons/text/StringSubstitutor.java -- diff --git a/src/main/java/org/apache/commons/text/StringSubstitutor.java b/src/main/java/org/apache/commons/text/StringSubstitutor.java index 8d98ecf..58f6e82 100644 --- a/src/main/java/org/apache/commons/text/StringSubstitutor.java +++ b/src/main/java/org/apache/commons/text/StringSubstitutor.java @@ -136,21 +136,21 @@ public class StringSubstitutor { /** * The default variable default separator. - * + * * @since 1.5. */ public static final String DEFAULT_VAR_DEFAULT = ":-"; /** * The default variable end separator. - * + * * @since 1.5. */ public static final String DEFAULT_VAR_END = "}"; /** * The default variable start separator. - * + * * @since 1.5. */ public static final String DEFAULT_VAR_START = "${"; http://git-wip-us.apache.org/repos/asf/commons-text/blob/4baa89f0/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java index 4155a24..383c10a 100644 --- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java @@ -33,7 +33,7 @@ import org.apache.commons.lang3.StringUtils; * hardware: "processors: 4, architecture: amd64-64, instruction sets: amd64" * locale: "default locale: en_US, platform encoding: iso-8859-1" * - * + * * @since 1.3 */ final class JavaPlatformStringLookup extends AbstractStringLookup { http://git-wip-us.apache.org/repos/asf/commons-text/blob/4baa89f0/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java b/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java index 7dd5c6b..8a14c1b 100644 --- a/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/ResourceBundleStringLookup.java @@ -49,7 +49,7 @@ final class ResourceBundleStringLookup extends AbstractStringLookup { /** * Constructs an instance that only works for the given bundle. - * + * * @since 1.5 */ ResourceBundleStringLookup(final String bundleName) { http://git-wip-us.apache.org/repos/asf/commons-text/blob/4baa89f0/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java index 86221e6..2b6f856 100644 --- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java +++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java @@ -33,7 +33,7 @@ public final class StringLookupFactory { /** * Clears any static resources. - * + * * @since 1.5 */ public static void clear() { @@ -289,7 +289,7 @@ public final class StringLookupFactory { * hardware: "processors: 4, architecture: amd64-64, instruction sets: amd64" * locale: "default locale: en_US, platform encoding: iso-8859-1" * - * + * * @return the JavaPlatformStringLookup singleton instance. */ public StringLookup javaPlatformStringLookup() {
[text] Javadoc.
Repository: commons-text Updated Branches: refs/heads/master b02f37bb0 -> 5d01c5966 Javadoc. Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/5d01c596 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/5d01c596 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/5d01c596 Branch: refs/heads/master Commit: 5d01c5966c3ede23a8ff474dfbd4d076062e2d19 Parents: b02f37b Author: Gary Gregory Authored: Fri Sep 28 09:21:42 2018 -0600 Committer: Gary Gregory Committed: Fri Sep 28 09:21:42 2018 -0600 -- .../text/lookup/JavaPlatformStringLookup.java | 333 +++ .../text/lookup/StringLookupFactory.java| 34 +- 2 files changed, 212 insertions(+), 155 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/5d01c596/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java index ee7f556..4155a24 100644 --- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java @@ -1,147 +1,186 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.commons.text.lookup; - -import java.util.Locale; - -import org.apache.commons.lang3.StringUtils; - -/** - * Looks up keys related to Java: Java version, JRE version, VM version, and so on. - * - * @since 1.3 - */ -final class JavaPlatformStringLookup extends AbstractStringLookup { - -/** - * Defines the singleton for this class. - */ -static final JavaPlatformStringLookup INSTANCE = new JavaPlatformStringLookup(); - -/** - * No need to build instances for now. - */ -private JavaPlatformStringLookup() { -// empty -} - -/** - * Accessible through the Lookup key {@code hardware}. - * - * @return hardware processor information. - */ -String getHardware() { -return "processors: " + Runtime.getRuntime().availableProcessors() + ", architecture: " -+ getSystemProperty("os.arch") + this.getSystemProperty("-", "sun.arch.data.model") -+ this.getSystemProperty(", instruction sets: ", "sun.cpu.isalist"); -} - -/** - * Accessible through the Lookup key {@code locale}. - * - * @return system locale and file encoding information. - */ -String getLocale() { -return "default locale: " + Locale.getDefault() + ", platform encoding: " + getSystemProperty("file.encoding"); -} - -/** - * Accessible through the Lookup key {@code os}. - * - * @return operating system information. - */ -String getOperatingSystem() { -return getSystemProperty("os.name") + " " + getSystemProperty("os.version") -+ getSystemProperty(" ", "sun.os.patch.level") + ", architecture: " + getSystemProperty("os.arch") -+ getSystemProperty("-", "sun.arch.data.model"); -} - -/** - * Accessible through the Lookup key {@code runtime}. - * - * @return Java Runtime Environment information. - */ -String getRuntime() { -return getSystemProperty("java.runtime.name") + " (build " + getSystemProperty("java.runtime.version") -+ ") from " + getSystemProperty("java.vendor"); -} - -/** - * Gets the given system property. - * - * @param name - *a system property name. - * @return a system property value. - */ -private String getSystemProperty(final String name) { -return SystemPropertyStringLookup.INSTANCE.lookup(name); -} - -/** - * Gets the given system property. - * - * @param prefix - *the prefix to use for the result string - * @param name - *a system property name. -
[text] Use final.
Repository: commons-text Updated Branches: refs/heads/master 1898b786a -> b02f37bb0 Use final. Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/b02f37bb Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/b02f37bb Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/b02f37bb Branch: refs/heads/master Commit: b02f37bb02b01ce73eee89658fc4501b53e0bce4 Parents: 1898b78 Author: Gary Gregory Authored: Fri Sep 28 09:03:05 2018 -0600 Committer: Gary Gregory Committed: Fri Sep 28 09:03:05 2018 -0600 -- .../java/org/apache/commons/text/lookup/StringLookupFactory.java | 2 +- .../org/apache/commons/text/lookup/UrlDecoderStringLookup.java | 2 +- .../org/apache/commons/text/lookup/UrlEncoderStringLookup.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/b02f37bb/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java index e22a8a0..73c3153 100644 --- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java +++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java @@ -359,7 +359,7 @@ public final class StringLookupFactory { * @return a ResourceBundleStringLookup instance for the given bundle name. * @since 1.5 */ -public StringLookup resourceBundleStringLookup(String bundleName) { +public StringLookup resourceBundleStringLookup(final String bundleName) { return new ResourceBundleStringLookup(bundleName); } http://git-wip-us.apache.org/repos/asf/commons-text/blob/b02f37bb/src/main/java/org/apache/commons/text/lookup/UrlDecoderStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/UrlDecoderStringLookup.java b/src/main/java/org/apache/commons/text/lookup/UrlDecoderStringLookup.java index ddd494d..55a2807 100644 --- a/src/main/java/org/apache/commons/text/lookup/UrlDecoderStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/UrlDecoderStringLookup.java @@ -47,7 +47,7 @@ final class UrlDecoderStringLookup extends AbstractStringLookup { final String enc = StandardCharsets.UTF_8.name(); try { return new String(URLDecoder.decode(key, enc)); -} catch (UnsupportedEncodingException e) { +} catch (final UnsupportedEncodingException e) { throw IllegalArgumentExceptions.format(e, "%s: source=%s, encoding=%s", e, key, enc); } } http://git-wip-us.apache.org/repos/asf/commons-text/blob/b02f37bb/src/main/java/org/apache/commons/text/lookup/UrlEncoderStringLookup.java -- diff --git a/src/main/java/org/apache/commons/text/lookup/UrlEncoderStringLookup.java b/src/main/java/org/apache/commons/text/lookup/UrlEncoderStringLookup.java index 20f9600..fdc2c1f 100644 --- a/src/main/java/org/apache/commons/text/lookup/UrlEncoderStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/UrlEncoderStringLookup.java @@ -46,7 +46,7 @@ final class UrlEncoderStringLookup extends AbstractStringLookup { final String enc = StandardCharsets.UTF_8.name(); try { return new String(URLEncoder.encode(key, enc)); -} catch (UnsupportedEncodingException e) { +} catch (final UnsupportedEncodingException e) { throw IllegalArgumentExceptions.format(e, "%s: source=%s, encoding=%s", e, key, enc); } }
svn commit: r1842239 - /commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java
Author: sebb Date: Fri Sep 28 11:36:14 2018 New Revision: 1842239 URL: http://svn.apache.org/viewvc?rev=1842239=rev Log: Allow command-line testing Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1842239=1842238=1842239=diff == --- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java (original) +++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Fri Sep 28 11:36:14 2018 @@ -233,4 +233,13 @@ public class ColognePhoneticTest extends final String data[] = {"Meier", "Maier", "Mair", "Meyer", "Meyr", "Mejer", "Major"}; this.checkEncodingVariations("67", data); } + +// Allow command-line testing +public static void main(String args[]) { +ColognePhonetic coder = new ColognePhonetic(); +for(String arg : args) { +String code = coder.encode(arg); +System.out.println("'" + arg + "' = '" + code + "'"); +} +} }