Package com.metaparadigm.jsonrpc

Examples of com.metaparadigm.jsonrpc.MarshallException


    } else if (geometry instanceof MultiLineString) {
      obj = fromMultiLineString((MultiLineString) geometry);
    } else if (geometry instanceof MultiPoint) {
      obj = fromMultiPoint((MultiPoint) geometry);
    } else {
      throw new MarshallException("cannot marshal " + geometry.getClass());
    }
    return obj;
  }
View Full Code Here


    BeanSerializerState beanState;
    try {
      beanState = (BeanSerializerState) state.get(BeanSerializerState.class);
    } catch (Exception e) {
      e.printStackTrace();
      throw new MarshallException("bean serializer internal error : " + e.getMessage());
    }
    Integer identity = System.identityHashCode(o);
    if (beanState.beanSet.contains(identity)) {
      throw new MarshallException("circular reference");
    }
    beanState.beanSet.add(identity);

    BeanData bd;
    try {
      bd = getBeanData(o.getClass());
    } catch (IntrospectionException e) {
      throw new MarshallException(o.getClass().getName() + " is not a bean");
    }

    JSONObject val = new JSONObject();
    if (ser.getMarshallClassHints()) {
      val.put("javaClass", o.getClass().getName());
    }
    Iterator i = bd.readableProps.entrySet().iterator();
    Object[] args = new Object[0];
    Object result;
    while (i.hasNext()) {
      Map.Entry ent = (Map.Entry) i.next();
      String prop = (String) ent.getKey();
      Method getMethod = (Method) ent.getValue();
      log.debug("invoking {}()", getMethod.getName());
      try {
        result = getMethod.invoke(o, args);
      } catch (Throwable e) {
        if (e instanceof InvocationTargetException) {
          e = ((InvocationTargetException) e).getTargetException();
        }
        throw new MarshallException("bean " + o.getClass().getName() + " can't invoke "
            + getMethod.getName() + ": " + e.getMessage());
      }
      try {
        if (result != null || ser.getMarshallNullAttributes()) {

          val.put(prop, ser.marshall(state, result));
        }
      } catch (MarshallException e) {
        throw new MarshallException("bean " + o.getClass().getName() + " " + e.getMessage());
      }
    }

    beanState.beanSet.remove(identity);
    return val;
View Full Code Here

TOP

Related Classes of com.metaparadigm.jsonrpc.MarshallException

Copyright © 2018 www.massapicom. 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.