diff --git a/toml/src/main/java/io/micronaut/toml/Parser.java b/toml/src/main/java/io/micronaut/toml/Parser.java index 814bf59e..db2a2b36 100644 --- a/toml/src/main/java/io/micronaut/toml/Parser.java +++ b/toml/src/main/java/io/micronaut/toml/Parser.java @@ -256,7 +256,12 @@ private JsonNode parseInt(int nextState) throws IOException { } } + JsonNode v = parseInt0(buffer, start, length); pollExpected(TomlToken.INTEGER, nextState); + return v; + } + + private JsonNode parseInt0(char[] buffer, int start, int length) throws TomlStreamReadException { if (length > 2) { char baseChar = buffer[start + 1]; if (baseChar == 'x' || baseChar == 'o' || baseChar == 'b') { diff --git a/toml/src/test/java/io/micronaut/toml/ParserTest.java b/toml/src/test/java/io/micronaut/toml/ParserTest.java index dcb68e4e..1496b27a 100644 --- a/toml/src/test/java/io/micronaut/toml/ParserTest.java +++ b/toml/src/test/java/io/micronaut/toml/ParserTest.java @@ -1016,4 +1016,14 @@ public void unknownEscape() throws IOException { Assertions.assertThrows(TomlStreamReadException.class, () -> toml("foo = \"\\k\"")).getOriginalMessage(), Matchers.containsString("Unknown escape sequence")); } + + @Test + // https://github.com/micronaut-projects/micronaut-toml/pull/95 + void longInput() { + Assertions.assertDoesNotThrow(() -> toml( + "foo = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n" + + "bar = 678\n" + + "baz = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" + )); + } }