Search in sources :

Example 51 with JSONException

use of com.alibaba.fastjson.JSONException in project fastjson by alibaba.

the class Issue779 method test_for_issue.

public void test_for_issue() throws Exception {
    Exception error = null;
    try {
        String aaa = "{'token':'token':'sign':'bb'}";
        JSON.parseObject(aaa);
    } catch (JSONException ex) {
        error = ex;
    }
    assertNotNull(error);
}
Also used : JSONException(com.alibaba.fastjson.JSONException) JSONException(com.alibaba.fastjson.JSONException)

Example 52 with JSONException

use of com.alibaba.fastjson.JSONException in project fastjson by alibaba.

the class Issue868 method test_int.

public void test_int() throws Exception {
    Exception error = null;
    try {
        String str = String.valueOf(Long.MAX_VALUE);
        JSON.parseObject(str, int.class);
    } catch (JSONException ex) {
        error = ex;
    }
    assertNotNull(error);
}
Also used : JSONException(com.alibaba.fastjson.JSONException) JSONException(com.alibaba.fastjson.JSONException)

Example 53 with JSONException

use of com.alibaba.fastjson.JSONException in project fastjson by alibaba.

the class Issue868 method test_short.

public void test_short() throws Exception {
    Exception error = null;
    try {
        String str = String.valueOf(Integer.MAX_VALUE);
        JSON.parseObject(str, short.class);
    } catch (JSONException ex) {
        error = ex;
    }
    assertNotNull(error);
}
Also used : JSONException(com.alibaba.fastjson.JSONException) JSONException(com.alibaba.fastjson.JSONException)

Example 54 with JSONException

use of com.alibaba.fastjson.JSONException in project fastjson by alibaba.

the class Issue868 method test_float_max.

public void test_float_max() throws Exception {
    Exception error = null;
    try {
        String str = String.valueOf(Double.MAX_VALUE);
        JSON.parseObject(str, float.class);
    } catch (JSONException ex) {
        error = ex;
    }
    assertNotNull(error);
}
Also used : JSONException(com.alibaba.fastjson.JSONException) JSONException(com.alibaba.fastjson.JSONException)

Example 55 with JSONException

use of com.alibaba.fastjson.JSONException in project fastjson by alibaba.

the class CommentTest method test_5.

public void test_5() throws Exception {
    Exception error = null;
    try {
        String text = "{ \"value\":1001/ * aa */}";
        JSON.parse(text);
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
Also used : JSONException(com.alibaba.fastjson.JSONException) JSONException(com.alibaba.fastjson.JSONException)

Aggregations

JSONException (com.alibaba.fastjson.JSONException)484 JSONReader (com.alibaba.fastjson.JSONReader)83 StringReader (java.io.StringReader)83 JSONScanner (com.alibaba.fastjson.parser.JSONScanner)37 JSONObject (com.alibaba.fastjson.JSONObject)28 DefaultJSONParser (com.alibaba.fastjson.parser.DefaultJSONParser)26 Map (java.util.Map)26 JSONLexer (com.alibaba.fastjson.parser.JSONLexer)17 IOException (java.io.IOException)17 ParseException (java.text.ParseException)8 ParserConfig (com.alibaba.fastjson.parser.ParserConfig)7 FieldInfo (com.alibaba.fastjson.util.FieldInfo)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7 JSONType (com.alibaba.fastjson.annotation.JSONType)6 JSONSerializer (com.alibaba.fastjson.serializer.JSONSerializer)6 Gson (com.google.gson.Gson)6 AccessibleObject (java.lang.reflect.AccessibleObject)6 Type (java.lang.reflect.Type)6 JSONField (com.alibaba.fastjson.annotation.JSONField)5 Point (java.awt.Point)5