-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix for writeBinary ensureCapacity, fix issue #537
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
core/src/test/java/com/alibaba/fastjson2/issues/Issue537.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.alibaba.fastjson2.issues; | ||
|
||
import com.alibaba.fastjson2.JSONWriter; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
public class Issue537 { | ||
@Test | ||
public void test() throws Exception { | ||
JSONWriter writer = JSONWriter.ofJSONB(); | ||
Field field = writer.getClass().getDeclaredField("bytes"); | ||
field.setAccessible(true); | ||
field.set(writer, new byte[1024 * 1024 + 5]); | ||
|
||
byte[] bytes = new byte[1024 * 1024]; | ||
writer.writeBinary(bytes); | ||
} | ||
} |