Merge branch 'trunk' of https://github.com/apache/directory-kerby into trunk
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
index 504932a..13492fd 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
@@ -63,7 +63,7 @@
while (originLine != null) {
String line = originLine.trim();
/*parse through comments*/
- if (line.startsWith("#") || line.length() == 0) {
+ if (line.isEmpty() || isComment(line)) {
originLine = br.readLine();
} else if (line.startsWith("[")) {
insertSections(line, br, items);
@@ -155,7 +155,7 @@
if (line == null) {
break;
}
- while (line.startsWith("#")) {
+ while (!line.isEmpty() && isComment(line)) {
line = br.readLine();
if (line == null) {
break;
@@ -192,7 +192,7 @@
}
return line;
}
- if (line.length() == 0 || line.startsWith("#")) {
+ if (line.isEmpty() || isComment(line)) {
line = br.readLine();
if (line != null) {
line = line.trim();
@@ -264,4 +264,8 @@
}
}
}
+
+ private boolean isComment(String line) {
+ return line.charAt(0) == '#' || line.charAt(0) == ';';
+ }
}
diff --git a/kerby-kerb/kerb-common/src/test/resources/krb5.conf b/kerby-kerb/kerb-common/src/test/resources/krb5.conf
index 43c62e2..a3b0d49 100644
--- a/kerby-kerb/kerb-common/src/test/resources/krb5.conf
+++ b/kerby-kerb/kerb-common/src/test/resources/krb5.conf
@@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+; this is also a comment
include /etc
[libdefaults]
default_realm = KRB.COM