mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
throw proper ConfigException if EOF occurs before a ${} token ends
It was throwing because -1 was passed to a %c format string
This commit is contained in:
parent
694dd9bef5
commit
aa8a258b59
@ -36,6 +36,8 @@ final class Tokenizer {
|
|||||||
return "newline";
|
return "newline";
|
||||||
else if (codepoint == '\t')
|
else if (codepoint == '\t')
|
||||||
return "tab";
|
return "tab";
|
||||||
|
else if (codepoint == -1)
|
||||||
|
return "end of file";
|
||||||
else if (Character.isISOControl(codepoint))
|
else if (Character.isISOControl(codepoint))
|
||||||
return String.format("control character 0x%x", codepoint);
|
return String.format("control character 0x%x", codepoint);
|
||||||
else
|
else
|
||||||
|
@ -167,7 +167,9 @@ class TokenizerTest extends TestUtils {
|
|||||||
"\"\\u\"", // too short
|
"\"\\u\"", // too short
|
||||||
"\"", // just a single quote
|
"\"", // just a single quote
|
||||||
""" "abcdefg""", // no end quote
|
""" "abcdefg""", // no end quote
|
||||||
"""\"\""" // file ends with a backslash
|
"""\"\""", // file ends with a backslash
|
||||||
|
"$", // file ends with a $
|
||||||
|
"${" // file ends with a ${
|
||||||
)
|
)
|
||||||
|
|
||||||
for (t <- invalidTests) {
|
for (t <- invalidTests) {
|
||||||
|
Loading…
Reference in New Issue
Block a user