本文整理汇总了Java中org.json.simple.parser.ParseException.ERROR_UNEXPECTED_EXCEPTION属性的典型用法代码示例。如果您正苦于以下问题:Java ParseException.ERROR_UNEXPECTED_EXCEPTION属性的具体用法?Java ParseException.ERROR_UNEXPECTED_EXCEPTION怎么用?Java ParseException.ERROR_UNEXPECTED_EXCEPTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.json.simple.parser.ParseException
的用法示例。
在下文中一共展示了ParseException.ERROR_UNEXPECTED_EXCEPTION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
private void add(final ValueType value) throws ParseException {
try {
builder.add(attribute, value);
attribute = null;
} catch (final VPackBuilderException e) {
throw new ParseException(ParseException.ERROR_UNEXPECTED_EXCEPTION);
}
}
示例2: close
private void close() throws ParseException {
try {
builder.close();
} catch (final VPackBuilderException e) {
throw new ParseException(ParseException.ERROR_UNEXPECTED_EXCEPTION);
}
}
示例3: primitive
@SuppressWarnings("unchecked")
@Override
public boolean primitive(final Object value) throws ParseException, IOException {
if (value == null) {
if (includeNullValues) {
add(ValueType.NULL);
} else {
attribute = null;
}
} else {
final VPackJsonSerializer<?> serializer = parser.getSerializer(attribute, value.getClass());
if (serializer != null) {
try {
((VPackJsonSerializer<Object>) serializer).serialize(builder, attribute, value);
attribute = null;
} catch (final VPackBuilderException e) {
throw new ParseException(ParseException.ERROR_UNEXPECTED_EXCEPTION);
}
} else if (String.class.isAssignableFrom(value.getClass())) {
add(String.class.cast(value));
} else if (Boolean.class.isAssignableFrom(value.getClass())) {
add(Boolean.class.cast(value));
} else if (Double.class.isAssignableFrom(value.getClass())) {
add(Double.class.cast(value));
} else if (Number.class.isAssignableFrom(value.getClass())) {
add(Long.class.cast(value));
}
}
return true;
}
示例4: parseRaw
/**
* Parse a JSON encoded string.
*
* @param in <code>Reader</code> over a JSON-encoded input to parse; not
* necessarily a JSON object.
* @return a regular Java <code>Object</code>.
* @throws ParseException
* @throws IOException
*/
protected static Object parseRaw(Reader in) throws ParseException, IOException {
try {
return getJSONParser().parse(in);
} catch (Error e) {
// Don't be stupid, org.json.simple. Bug 1042929.
throw new ParseException(ParseException.ERROR_UNEXPECTED_EXCEPTION, e);
}
}