Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 7dd9f89

Browse files
committed
bug fixed for JSONScanner. issue #1001
1 parent 9ce20b3 commit 7dd9f89

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/main/java/com/alibaba/fastjson/parser/JSONReaderScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public final char next() {
165165
if (sp > 0) {
166166
int offset;
167167
offset = bufLength - sp;
168-
if (ch == '"') {
168+
if (ch == '"' && offset > 0) {
169169
offset--;
170170
}
171171
System.arraycopy(buf, offset, buf, 0, sp);
@@ -298,7 +298,7 @@ public final BigDecimal decimalValue() {
298298
public void close() {
299299
super.close();
300300

301-
if (buf.length <= 1024 * 32) {
301+
if (buf.length <= 1024 * 64) {
302302
BUF_LOCAL.set(buf);
303303
}
304304
this.buf = null;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.alibaba.json.test;
2+
3+
import com.alibaba.fastjson.JSON;
4+
import com.alibaba.fastjson.JSONReader;
5+
import junit.framework.TestCase;
6+
import org.apache.commons.io.FileUtils;
7+
8+
import java.io.File;
9+
import java.io.StringReader;
10+
11+
/**
12+
* Created by wenshao on 21/01/2017.
13+
*/
14+
public class Issue1001 extends TestCase {
15+
public void test_for_issue() throws Exception {
16+
File file = new File("/Users/wenshao/Downloads/issue_1001.json");
17+
18+
String json = FileUtils.readFileToString(file);
19+
20+
JSONReader reader = new JSONReader(new StringReader(json));
21+
reader.readObject();
22+
}
23+
}

0 commit comments

Comments
 (0)