Skip to content

Commit 93d995d

Browse files
committed
Fixes. Ready for tagging v0.2
1 parent f2c468f commit 93d995d

5 files changed

Lines changed: 16 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ In `examples/sshd.tstconfig`:
2727
file /etc/ssh/sshd_config
2828

2929
# The syntax for parsing
30-
syntax ssh
30+
parse_mode tokenized
31+
hash_comment_allowed true
3132

3233
# Check that root cannot login via ssh
3334
property PermitRootLogin
@@ -43,7 +44,7 @@ Tstconfig's output is a report of the tests that passed or failed, with details
4344
on the tests that failed:
4445

4546
$ tstconfig examples/sshd.tstconfig
46-
Tstconfig 0.1
47+
Tstconfig 0.2
4748

4849
Reading definition file: examples/sshd.tstconfig
4950
ASSERTION FAILED

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.softwareloop</groupId>
88
<artifactId>tstconfig</artifactId>
9-
<version>0.2-SNAPSHOT</version>
9+
<version>0.2</version>
1010
<properties>
1111
<commons.io.version>2.4</commons.io.version>
1212
<commons.lang.version>3.3.2</commons.lang.version>

src/main/examples/fail2ban.tstconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
file /etc/fail2ban/jail.conf
77

88
# The syntax for parsing
9-
syntax fail2ban
9+
syntax ini
1010

1111
# Select the ssh section
1212
section ssh

src/main/java/com/softwareloop/tstconfig/Config.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public void parseKeyValue(String line) {
228228
if (separator == null) {
229229
values = new String[]{valueString};
230230
} else {
231-
StrTokenizer tokenizer = new StrTokenizer(valueString, separator);
231+
StrTokenizer tokenizer = createStrTokenizer(valueString);
232232
values = tokenizer.getTokenArray();
233233
}
234234

@@ -255,13 +255,19 @@ public void parseFixed(String line) {
255255
}
256256

257257
public void parseTokenized(String line) {
258-
StrTokenizer tokenizer = new StrTokenizer(line, separator);
259-
tokenizer.setIgnoreEmptyTokens(ignoreEmptyTokens);
260-
tokenizer.setQuoteChar(quoteChar);
258+
StrTokenizer tokenizer = createStrTokenizer(line);
261259
String[] tokens = tokenizer.getTokenArray();
262260
storeLine(tokens);
263261
}
264262

263+
public StrTokenizer createStrTokenizer(String valueString) {
264+
StrTokenizer tokenizer = new StrTokenizer(valueString, separator);
265+
tokenizer.setIgnoreEmptyTokens(ignoreEmptyTokens);
266+
tokenizer.setQuoteChar(quoteChar);
267+
return tokenizer;
268+
}
269+
270+
265271
//--------------------------------------------------------------------------
266272
// Getters/setters
267273
//--------------------------------------------------------------------------

src/main/java/com/softwareloop/tstconfig/Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public void section(String... args) {
330330

331331
public void section_size(String... args) {
332332
ensureConfigInitialized();
333-
propertyNames = null
333+
propertyNames = null;
334334
values = new String[1];
335335
values[0] = Integer.toString(section.size());
336336
}

0 commit comments

Comments
 (0)