Examples of MarshallException


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

                    // put a slot where the object would go, so it can be fixed up properly in the fix up phase
                    jsonOut.put(i, JSONObject.NULL);
                }
            }
        } catch (MarshallException e) {
            throw new MarshallException("element " + i, e);
        } catch (JSONException e) {
            throw new MarshallException("element " + i, e);
        }
        return jsonOut;
    }
View Full Code Here

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

        if (_ser.getMarshallClassHints()) {
            try {
                // obj.put(TAG_JAVACLASS, BeanUtils.getClassName(o));
                obj.put(TAG_JAVACLASS, LinkedList.class.getName()); // replace with linkedlist
            } catch (JSONException e) {
                throw new MarshallException("javaClass not found!", e);
            }
        }
        try {
            obj.put("list", arr);
            state.push(o, arr, "list");
        } catch (JSONException e) {
            throw new MarshallException("Error setting list: " + e, e);
        }
        int index = 0;
        try {
            Iterator i = list.iterator();
            while (i.hasNext()) {
                Object json = _ser.marshall(state, arr, i.next(), new Integer(index));
                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != json) {
                    arr.put(json);
                } else {
                    // put a slot where the object would go, so it can be fixed up properly in the fix up phase
                    arr.put(JSONObject.NULL);
                }
                index++;
            }
        } catch (MarshallException e) {
            throw new MarshallException("element " + index, e);
        } finally {
            state.pop();
        }
        return obj;
    }
View Full Code Here

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

                return new String((char[]) o);
            } else {
                return o;
            }
        } catch (Throwable t) {
            throw new MarshallException(t.toString(), t);
        }
    }
View Full Code Here

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

                        BeanUtils.getClassName(o));
            }
            obj.put("map", mapdata);
            state.push(o, mapdata, "map");
        } catch (JSONException e) {
            throw new MarshallException("Could not put data" + e.getMessage(), e);
        }
        Object key = null;

        try {
            Enumeration en = ht.keys();
            while (en.hasMoreElements()) {
                key = en.nextElement();
                String keyString = key.toString()// only support String keys

                Object json = _ser.marshall(state, mapdata, ht.get(key), keyString);

                // omit the object entirely if it's a circular reference or duplicate
                // it will be regenerated in the fixups phase
                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != json) {
                    mapdata.put(keyString, json);
                }

            }
        } catch (MarshallException e) {
            throw new MarshallException("map key " + key + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new MarshallException("map key " + key + " " + e.getMessage(), e);
        } finally {
            state.pop();
        }
        return obj;
    }
View Full Code Here

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

        JSONObject setdata = new JSONObject();
        if (_ser.getMarshallClassHints()) {
            try {
                obj.put(TAG_JAVACLASS, BeanUtils.getClassName(o));
            } catch (JSONException e) {
                throw new MarshallException("javaClass not found!", e);
            }
        }
        try {
            obj.put("set", setdata);
            state.push(o, setdata, "set");
        } catch (JSONException e) {
            throw new MarshallException("Could not set 'set': " + e.getMessage(), e);
        }
        Object key = null;
        Iterator i = set.iterator();

        try {
            while (i.hasNext()) {
                key = i.next();
                String keyString = key.toString()// only support String keys
                Object json = _ser.marshall(state, setdata, key, keyString);

                // omit the object entirely if it's a circular reference or duplicate
                // it will be regenerated in the fixups phase
                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != json) {
                    setdata.put(keyString, json);
                }
            }
        } catch (MarshallException e) {
            throw new MarshallException("set key " + key + e.getMessage(), e);
        } catch (JSONException e) {
            throw new MarshallException("set key " + key + e.getMessage(), e);
        } finally {
            state.pop();
        }
        return obj;
    }
View Full Code Here

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

        JSONObject mapdata = new JSONObject();
        if (_ser.getMarshallClassHints()) {
            try {
                obj.put(TAG_JAVACLASS, BeanUtils.getClassName(o));
            } catch (JSONException e) {
                throw new MarshallException("javaClass not found!", e);
            }
        }
        try {
            obj.put("map", mapdata);
            state.push(o, mapdata, "map");
        } catch (JSONException e) {
            throw new MarshallException("Could not add map to object: " + e.getMessage(), e);
        }
        Object key = null;
        try {
            Iterator i = map.entrySet().iterator();
            while (i.hasNext()) {
                Map.Entry ent = (Map.Entry) i.next();
                key = ent.getKey();
                String keyString = key.toString()// only support String keys

                Object json = _ser.marshall(state, mapdata, ent.getValue(), keyString);

                // omit the object entirely if it's a circular reference or duplicate
                // it will be regenerated in the fixups phase
                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != json) {
                    mapdata.put(keyString, json);
                }
            }
        } catch (MarshallException e) {
            throw new MarshallException("map key " + key + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new MarshallException("map key " + key + " " + e.getMessage(), e);
        } finally {
            state.pop();
        }
        return obj;
    }
View Full Code Here

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

            throws MarshallException {
        long time;
        if (o instanceof Date) {
            time = ((Date) o).getTime();
        } else {
            throw new MarshallException("cannot marshall date using class " + o.getClass());
        }
        JSONObject obj = new JSONObject();
        try {
            if (_ser.getMarshallClassHints()) {
                obj.put(TAG_JAVACLASS, BeanUtils.getClassName(o));
            }
            obj.put("time", time);
        } catch (JSONException e) {
            throw new MarshallException(e.getMessage(), e);
        }
        return obj;
    }
View Full Code Here

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

                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != j) {
                    jsonOut.put(key, j);
                }
            }
        } catch (MarshallException e) {
            throw new MarshallException("JSONObject key " + key + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new MarshallException("JSONObject key " + key + " " + e.getMessage(), e);
        }
        return jsonOut;
    }
View Full Code Here

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

            try {
                jso.put("JSONRPCType", "Reference");
                jso.put(TAG_JAVACLASS, BeanUtils.getClassName(clazz));
                jso.put("objectID", identity);
            } catch (JSONException e) {
                throw new MarshallException(e.getMessage(), e);
            }
            return jso;
        } else if (bridge.isCallableReference(clazz)) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("marshalling callable reference to object " +
                        identity + " of class " + clazz.getName());
            }
            bridge.registerObject(identity, o);
            bridge.addReference(o);

            JSONObject jso = new JSONObject();
            try {
                jso.put("JSONRPCType", "CallableReference");
                jso.put(TAG_JAVACLASS, BeanUtils.getClassName(clazz));
                jso.put("objectID", identity);
            } catch (JSONException e) {
                throw new MarshallException(e.getMessage(), e);
            }

            return jso;
        }
        return null;
View Full Code Here

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

        // Have a single function to do it.
        if (_ser.getMarshallClassHints()) {
            try {
                obj.put(TAG_JAVACLASS, BeanUtils.getClassName(o));
            } catch (JSONException e) {
                throw new MarshallException("javaClass not found!", e);
            }
        }
        try {
            obj.put("list", arr);
            state.push(o, arr, "list");
        } catch (JSONException e) {
            throw new MarshallException("Error setting list: " + e, e);
        }
        int index = 0;
        try {
            Iterator i = list.iterator();
            while (i.hasNext()) {
                Object json = _ser.marshall(state, arr, i.next(), new Integer(index));
                if (JSONSerializerController.CIRC_REF_OR_DUPLICATE != json) {
                    arr.put(json);
                } else {
                    // put a slot where the object would go, so it can be fixed up properly in the fix up phase
                    arr.put(JSONObject.NULL);
                }
                index++;
            }
        } catch (MarshallException e) {
            throw new MarshallException("element " + index, e);
        } finally {
            state.pop();
        }
        return obj;
    }
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.