Skip to content

Commit

Permalink
Fix issue with a big YAML with emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
asomov committed Sep 17, 2024
1 parent d713629 commit ebcfd6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</properties>
<body>
<release version="2.4" date="in GIT" description="Maintenance">
<action dev="asomov" type="add" issue="1098">
Add a test for parsing emoji from string (thanks to Madalin Ilie)
<action dev="asomov" type="fix" issue="1098">
Fix issue with a big YAML with emoji (thanks to Madalin Ilie)
</action>
<action dev="asomov" type="add" issue="1097">
Refactor Scanner to improve performance (thanks to David Schlosnagle)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/yaml/snakeyaml/reader/StreamReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> sourceTree = yaml.load(str);
assertEquals(5, sourceTree.size());
}

@Test
Expand Down

0 comments on commit ebcfd6c

Please sign in to comment.