You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/04/24 23:54:08 UTC
[juneau] branch master updated: Minor bug fix in config API.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new c3b4004 Minor bug fix in config API.
c3b4004 is described below
commit c3b4004fd884c29b56b835836c82bbfdd2dd542a
Author: JamesBognar <ja...@apache.org>
AuthorDate: Tue Apr 24 19:53:55 2018 -0400
Minor bug fix in config API.
---
.../java/org/apache/juneau/config/internal/ConfigMap.java | 2 +-
.../main/java/org/apache/juneau/internal/StringUtils.java | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
index b2b3e72..db48420 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
@@ -99,7 +99,7 @@ public class ConfigMap implements ConfigStoreListener {
boolean foundComment = false;
for (ListIterator<String> li = lines.listIterator(); li.hasNext();) {
String l = li.next();
- char c = StringUtils.firstNonWhitespaceChar(l);
+ char c = firstChar(l);
if (c != '#') {
if (c == 0 && foundComment) {
li.set("[]");
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
index d7717a4..9ec58cc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -2256,4 +2256,16 @@ public final class StringUtils {
return Integer.MAX_VALUE;
return s1.compareTo(s2);
}
+
+ /**
+ * Returns the first character in the specified string.
+ *
+ * @param s The string to check.
+ * @return The first character in the string, or <code>0</code> if the string is <jk>null</jk> or empty.
+ */
+ public static char firstChar(String s) {
+ if (s == null || s.length() == 0)
+ return 0;
+ return s.charAt(0);
+ }
}
--
To stop receiving notification emails like this one, please contact
jamesbognar@apache.org.