You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2018/09/28 16:47:29 UTC
[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 <a4...@yeah.net>
Authored: Fri Sep 14 20:34:11 2018 +0800
Committer: nickwongwong <a4...@yeah.net>
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 {
* </ul>
*
* @param stringLookupMap
+ * the map of string lookups.
* @since 1.5
*/
public void addDefaultStringLookups(final Map<String, StringLookup> 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 BufferedInputStream(url.openStream()),
charsetName)) {
int n;
http://git-wip-us.apache.org/repos/asf/commons-text/blob/189f4210/src/test/resources/document.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/document.properties b/src/test/resources/document.properties
index f411d5e..2f3bc8c 100644
--- a/src/test/resources/document.properties
+++ b/src/test/resources/document.properties
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-mykey = Hello World!
\ No newline at end of file
+mykey = Hello World!