Search in sources :

Example 1 with QAJsonException

use of cn.jeesoft.qa.error.QAJsonException in project QuickAndroid by ImKarl.

the class QAJsonArray method copy.

private <T> QAJsonArray copy(JSONTokener copyFrom) {
    if (copyFrom == null) {
        throw new QANullException("'json source' can not be NULL.");
    }
    Object object = null;
    try {
        object = copyFrom.nextValue();
        copy((JSONArray) object);
    } catch (JSONException e) {
        throw new QAJsonException(QAException.CODE_FORMAT, e);
    } catch (ClassCastException e) {
        throw new QAJsonException(QAException.CODE_CLASSCAST, String.valueOf(object) + " cannot be cast to JSONArray");
    }
    return this;
}
Also used : QAJsonException(cn.jeesoft.qa.error.QAJsonException) JSONException(org.json.JSONException) QANullException(cn.jeesoft.qa.error.QANullException)

Example 2 with QAJsonException

use of cn.jeesoft.qa.error.QAJsonException in project QuickAndroid by ImKarl.

the class QAJsonObject method copy.

private <T> QAJsonObject copy(JSONTokener copyFrom) {
    if (copyFrom == null) {
        throw new QANullException("'json source' can not be NULL.");
    }
    Object object = null;
    try {
        object = copyFrom.nextValue();
        copy((JSONObject) object);
    } catch (JSONException e) {
        throw new QAJsonException(QAException.CODE_FORMAT, e);
    } catch (ClassCastException e) {
        throw new QAJsonException(QAException.CODE_CLASSCAST, String.valueOf(object) + " cannot be cast to JSONArray");
    }
    return this;
}
Also used : QAJsonException(cn.jeesoft.qa.error.QAJsonException) JSONException(org.json.JSONException) QANullException(cn.jeesoft.qa.error.QANullException) JSONObject(org.json.JSONObject)

Aggregations

QAJsonException (cn.jeesoft.qa.error.QAJsonException)2 QANullException (cn.jeesoft.qa.error.QANullException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)1