Search in sources :

Example 71 with SerializeWriter

use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.

the class SerializeWriterTest_9 method test_error_5.

public void test_error_5() throws Exception {
    SerializeWriter writer = new SerializeWriter(new StringWriter());
    Exception error = null;
    try {
        writer.toBytes("UTF-8");
    } catch (Exception ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    writer.close();
}
Also used : SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter) StringWriter(java.io.StringWriter)

Example 72 with SerializeWriter

use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.

the class SerializeWriterTest_10 method test_erro_0.

public void test_erro_0() throws Exception {
    SerializeWriter out = new SerializeWriter();
    Exception error = null;
    try {
        out.write(new char[0], -1, 0);
    } catch (Exception ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    out.close();
}
Also used : SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter)

Example 73 with SerializeWriter

use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.

the class SerializeWriterTest_10 method test_erro_1.

public void test_erro_1() throws Exception {
    SerializeWriter out = new SerializeWriter();
    Exception error = null;
    try {
        out.write(new char[0], 1, 0);
    } catch (Exception ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    out.close();
}
Also used : SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter)

Example 74 with SerializeWriter

use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.

the class SerializeWriterTest_10 method test_erro_2.

public void test_erro_2() throws Exception {
    SerializeWriter out = new SerializeWriter();
    Exception error = null;
    try {
        out.write(new char[0], 0, -1);
    } catch (Exception ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    out.close();
}
Also used : SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter)

Example 75 with SerializeWriter

use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.

the class SerializeWriterTest_10 method test_erro_4.

public void test_erro_4() throws Exception {
    SerializeWriter out = new SerializeWriter();
    Exception error = null;
    try {
        out.write(new char[] { '0', '0' }, 1, Integer.MAX_VALUE);
    } catch (Exception ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    out.close();
}
Also used : SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter)

Aggregations

SerializeWriter (com.alibaba.fastjson.serializer.SerializeWriter)345 JSONSerializer (com.alibaba.fastjson.serializer.JSONSerializer)206 PropertyFilter (com.alibaba.fastjson.serializer.PropertyFilter)54 HashMap (java.util.HashMap)47 StringWriter (java.io.StringWriter)38 NameFilter (com.alibaba.fastjson.serializer.NameFilter)36 ValueFilter (com.alibaba.fastjson.serializer.ValueFilter)19 ArrayList (java.util.ArrayList)12 ListSerializer (com.alibaba.fastjson.serializer.ListSerializer)11 MapSerializer (com.alibaba.fastjson.serializer.MapSerializer)10 JavaBeanSerializer (com.alibaba.fastjson.serializer.JavaBeanSerializer)8 Date (java.util.Date)8 Map (java.util.Map)8 CollectionCodec (com.alibaba.fastjson.serializer.CollectionCodec)6 SerializeConfig (com.alibaba.fastjson.serializer.SerializeConfig)6 LinkedHashMap (java.util.LinkedHashMap)6 JSONException (com.alibaba.fastjson.JSONException)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 A (com.alibaba.json.bvt.serializer.filters.PropertyFilterTest.A)4 JSONObject (com.alibaba.fastjson.JSONObject)3