diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 28006c04..54e6a79a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -6,8 +6,8 @@ - - Add a test for parsing emoji from string (thanks to Madalin Ilie) + + Fix issue with a big YAML with emoji (thanks to Madalin Ilie) Refactor Scanner to improve performance (thanks to David Schlosnagle) diff --git a/src/main/java/org/yaml/snakeyaml/reader/StreamReader.java b/src/main/java/org/yaml/snakeyaml/reader/StreamReader.java index a803471d..199038df 100644 --- a/src/main/java/org/yaml/snakeyaml/reader/StreamReader.java +++ b/src/main/java/org/yaml/snakeyaml/reader/StreamReader.java @@ -175,7 +175,7 @@ private boolean ensureEnoughData(int size) { private void update() { try { - int read = stream.read(buffer); + int read = stream.read(buffer, 0, buffer.length - 1); // FIXME why -1 ??? if (read > 0) { int cpIndex = (dataLength - pointer); dataWindow = Arrays.copyOfRange(dataWindow, pointer, dataLength + read); diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue1098/OpenApiTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue1098/OpenApiTest.java index 2d312cc6..849a1e12 100644 --- a/src/test/java/org/yaml/snakeyaml/issues/issue1098/OpenApiTest.java +++ b/src/test/java/org/yaml/snakeyaml/issues/issue1098/OpenApiTest.java @@ -40,12 +40,8 @@ public void loadAsInputStream() { public void loadAsString() { String str = Util.getLocalResource("issues/issue1098-openapi.yaml"); Yaml yaml = new Yaml(); - try { - yaml.load(str); - fail("Use stream to parse emoji"); - } catch (IndexOutOfBoundsException e) { - // FIXME - } + Map sourceTree = yaml.load(str); + assertEquals(5, sourceTree.size()); } @Test