Package com.skaringa.javaxml

Examples of com.skaringa.javaxml.DeserializerException


      numberOrBooleanOrNull(m_tokenizer.sval);
      expectEndOfValue();
    } else if (type == COMMA) {
      // eat
    } else {
      throw new DeserializerException("Unexpected token: "
          + (type == StreamTokenizer.TT_WORD ? m_tokenizer.sval : String
              .valueOf((char) type)));
    }
  }
View Full Code Here


  private void name(String sval) throws DeserializerException {
    Log.debug("name", sval);
   
    ObjectDeserializerHolder objHolder = (ObjectDeserializerHolder) _objHolderStack.peek();
    if (END_OBJECT != objHolder.getJsonStructureTag()) {
      throw new DeserializerException("wrong containment of ':' inside array.");
    }
   
    _name = sval;
  }
View Full Code Here

  private void end(String val, char jsonStructureTag)
      throws DeserializerException {
    ObjectDeserializerHolder objHolder = (ObjectDeserializerHolder) _objHolderStack
        .pop();
    if (jsonStructureTag != objHolder.getJsonStructureTag()) {
      throw new DeserializerException("Wrong sequence: Expected '"
          + jsonStructureTag + "' but was '" + objHolder.getJsonStructureTag()
          + "'");
    }

    Object obj = objHolder.getSer().endDeserialize(objHolder.getObj(), val);
    objHolder.setObj(obj);

    try {
      ObjectDeserializerHolder parentHolder = (ObjectDeserializerHolder) _objHolderStack
          .peek();
      parentHolder.getSer().setMember(parentHolder.getObj(),
          objHolder.getName(), obj);
    } catch (java.util.EmptyStackException e) {
      // leave the top level object at the stack
      _objHolderStack.push(objHolder);
    } catch (NoSuchFieldException e) {
      if (!PropertyHelper.parseBoolean(_propertyMap,
          PropertyKeys.SKIP_UNKNOWN_FIELDS)) {
        throw new DeserializerException("no such field: " + e.getMessage());
      }
    }
    _name = null;
  }
View Full Code Here

  private void expectEndOfValue() throws DeserializerException,
      IOException {
    int token = m_tokenizer.nextToken();
    if (endOfValue.indexOf((char) token) < 0) {
      throw new DeserializerException("Parsing error: Expected one of '" + endOfValue
          + "' but got '" + (char) token + "'");
    }
    m_tokenizer.pushBack();
  }
View Full Code Here

    if (obj != null) {
      try {
        obj = newFormatter(_xmlTypeName).parse(text);
      }
      catch (java.text.ParseException e) {
        throw new DeserializerException(e.getMessage());
      }
    }

    return obj;
  }
View Full Code Here

   */
  public void setMember(Object parent, String name, Object value)
    throws DeserializerException {

    // not allowed with date type
    throw new DeserializerException(
      "no child element allowed for java.util.Date");
  }
View Full Code Here

      }
//      else if (members.containsKey(LANGUAGE_FIELD_NAME)) {
//        return new Locale((String) members.get(LANGUAGE_FIELD_NAME));
//      }
// keep 1.3 compatible!     
      throw new DeserializerException(
        "Locale have no language and country fields - can't deserialize.");
    }

    return obj;
  }
View Full Code Here

    if (componentType == null && TYPENAME_PREFIX.equals(_xmlTypeName)) {
      // try to get the component type from the parent
      // this is for backward compatibility (typename was "array" only)
      componentType = getFieldType(parent, name).getComponentType();
      if (componentType == null) {
        throw new DeserializerException(
          "Can't get component type for: " + _xmlTypeName);
      }
    }

    return new ArrayHelper(helperVector, componentType);
View Full Code Here

    checkSequence(parent);
    ArrayHelper helper = (ArrayHelper) parent;

    if (helper.getVector() == null) {
      throw new DeserializerException("child of null object is forbidden");
    }

    helper.add(value);
  }
View Full Code Here

   * @param obj The object to check.
   * @throws DeserializerException If the object is not of type ArrayHelper.
   */
  private void checkSequence(Object obj) throws DeserializerException {
    if (!(obj instanceof ArrayHelper)) {
      throw new DeserializerException(
        "invalid sequence: array expected, but was: "
          + obj.getClass().getName());
    }
  }
View Full Code Here

TOP

Related Classes of com.skaringa.javaxml.DeserializerException

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.