Examples of UnmarshallException


Examples of org.sf.bee.commons.remoting.jrpc.exceptions.impl.UnmarshallException

        JSONObject jso = (JSONObject) o;
        String java_class;
        try {
            java_class = jso.getString(TAG_JAVACLASS);
        } catch (JSONException e) {
            throw new UnmarshallException("Could not read javaClass", e);
        }
        if (java_class == null) {
            throw new UnmarshallException("no type hint");
        }
        AbstractList al;
        if (java_class.equals("java.util.List") ||
                java_class.equals("java.util.AbstractList") ||
                java_class.equals("java.util.ArrayList")) {
            al = new ArrayList();
        } else if (java_class.equals("java.util.LinkedList")) {
            al = new LinkedList();
        } else if (java_class.equals("java.util.Vector")) {
            al = new Vector();
        } else {
            throw new UnmarshallException("not a List");
        }

        JSONArray jsonlist;
        try {
            jsonlist = jso.getJSONArray("list");
        } catch (JSONException e) {
            throw new UnmarshallException("Could not read list: " + e.getMessage(), e);
        }
        if (jsonlist == null) {
            throw new UnmarshallException("list missing");
        }
        state.setSerialized(o, al);
        int i = 0;
        try {
            for (; i < jsonlist.length(); i++) {
                al.add(_ser.unmarshall(state, null, jsonlist.get(i)));
            }
        } catch (UnmarshallException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
        }
        return al;
    }
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.exceptions.impl.UnmarshallException

        try {
            for (; i < jso.length(); i++) {
                m.setMismatch(_ser.tryUnmarshall(state, cc, jso.get(i)).max(m).getMismatch());
            }
        } catch (UnmarshallException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage() + " not found in json object", e);
        }
        return m;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.