Removed trailing newlines from error messages.

Fixes https://github.com/mwanji/toml4j/issues/18
This commit is contained in:
moandji.ezana 2015-06-23 23:35:52 +02:00
parent 9f29f6951f
commit 1b2aa582d9
2 changed files with 15 additions and 24 deletions

View file

@ -5,11 +5,12 @@
### Changed ### Changed
* __BREAKING:__ Toml#getList(String), Toml#getTable(String) and Toml#getTables(String) return null when key is not found * __BREAKING:__ Toml#getList(String), Toml#getTable(String) and Toml#getTables(String) return null when key is not found
* Removed trailing newline from error messages
### Added ### Added
* Support for underscores in numbers (the feature branch had accidentally not been merged! :( ) * Support for underscores in numbers (the feature branch had accidentally not been merged! :( )
* Toml#entrySet() * Set<Map.Entry> Toml#entrySet() cf. Reflection section in README
* Overloaded getters that take a default value. Thanks to __[udiabon](https://github.com/udiabon)__. * Overloaded getters that take a default value. Thanks to __[udiabon](https://github.com/udiabon)__.
## 0.4.0 / 2015-02-16 ## 0.4.0 / 2015-02-16

View file

@ -19,7 +19,7 @@ class Results {
.append(line) .append(line)
.append(": [") .append(": [")
.append(table) .append(table)
.append("]\n"); .append("]");
} }
public void tableDuplicatesKey(String table, AtomicInteger line) { public void tableDuplicatesKey(String table, AtomicInteger line) {
@ -27,21 +27,19 @@ class Results {
.append(line.get()) .append(line.get())
.append(": [") .append(": [")
.append(table) .append(table)
.append("]\n"); .append("]");
} }
public void keyDuplicatesTable(String key, AtomicInteger line) { public void keyDuplicatesTable(String key, AtomicInteger line) {
sb.append("Table already exists for key defined on line ") sb.append("Table already exists for key defined on line ")
.append(line.get()) .append(line.get())
.append(": ") .append(": ")
.append(key) .append(key);
.append('\n');
} }
void emptyImplicitTable(String table, int line) { void emptyImplicitTable(String table, int line) {
sb.append("Invalid table definition due to empty implicit table name: ") sb.append("Invalid table definition due to empty implicit table name: ")
.append(table) .append(table);
.append("\n");
} }
void invalidTable(String table, int line) { void invalidTable(String table, int line) {
@ -49,7 +47,7 @@ class Results {
.append(line) .append(line)
.append(": ") .append(": ")
.append(table) .append(table)
.append("]\n"); .append("]");
} }
void duplicateKey(String key, int line) { void duplicateKey(String key, int line) {
@ -59,8 +57,7 @@ class Results {
.append(line); .append(line);
} }
sb.append(": ") sb.append(": ")
.append(key) .append(key);
.append('\n');
} }
void invalidTextAfterIdentifier(Identifier identifier, char text, int line) { void invalidTextAfterIdentifier(Identifier identifier, char text, int line) {
@ -68,24 +65,21 @@ class Results {
.append(identifier.getName()) .append(identifier.getName())
.append(" on line ") .append(" on line ")
.append(line) .append(line)
.append(". Make sure to terminate the value or add a comment (#).") .append(". Make sure to terminate the value or add a comment (#).");
.append('\n');
} }
void invalidKey(String key, int line) { void invalidKey(String key, int line) {
sb.append("Invalid key on line ") sb.append("Invalid key on line ")
.append(line) .append(line)
.append(": ") .append(": ")
.append(key) .append(key);
.append('\n');
} }
void invalidTableArray(String tableArray, int line) { void invalidTableArray(String tableArray, int line) {
sb.append("Invalid table array definition on line ") sb.append("Invalid table array definition on line ")
.append(line) .append(line)
.append(": ") .append(": ")
.append(tableArray) .append(tableArray);
.append('\n');
} }
void invalidValue(String key, String value, int line) { void invalidValue(String key, String value, int line) {
@ -94,16 +88,14 @@ class Results {
.append(": ") .append(": ")
.append(key) .append(key)
.append(" = ") .append(" = ")
.append(value) .append(value);
.append('\n');
} }
void unterminatedKey(String key, int line) { void unterminatedKey(String key, int line) {
sb.append("Key is not followed by an equals sign on line ") sb.append("Key is not followed by an equals sign on line ")
.append(line) .append(line)
.append(": ") .append(": ")
.append(key) .append(key);
.append('\n');
} }
void unterminated(String key, String value, int line) { void unterminated(String key, String value, int line) {
@ -112,15 +104,13 @@ class Results {
.append(": ") .append(": ")
.append(key) .append(key)
.append(" = ") .append(" = ")
.append(value.trim()) .append(value.trim());
.append('\n');
} }
public void heterogenous(String key, int line) { public void heterogenous(String key, int line) {
sb.append(key) sb.append(key)
.append(" becomes a heterogeneous array on line ") .append(" becomes a heterogeneous array on line ")
.append(line) .append(line);
.append('\n');
} }
boolean hasErrors() { boolean hasErrors() {