本文整理了Java中com.alibaba.fastjson.JSONException.getMessage()
方法的一些代码示例,展示了JSONException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONException.getMessage()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONException
类名称:JSONException
方法名:getMessage
暂无
代码示例来源:origin: hs-web/hsweb-framework
@ExceptionHandler(JSONException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
ResponseMessage handleException(JSONException exception) {
logger.error(exception.getMessage(), exception);
return ResponseMessage.error(400, "解析JSON失败");
}
代码示例来源:origin: alibaba/fastjson
/**
* Method that JAX-RS container calls to deserialize given value.
*/
public Object readFrom(Class<Object> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType, //
MultivaluedMap<String, String> httpHeaders, //
InputStream entityStream) throws IOException, WebApplicationException {
try {
FastJsonConfig fastJsonConfig = locateConfigProvider(type, mediaType);
return JSON.parseObject(entityStream,
fastJsonConfig.getCharset(),
genericType,
fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(),
JSON.DEFAULT_PARSER_FEATURE,
fastJsonConfig.getFeatures());
} catch (JSONException ex) {
throw new WebApplicationException("JSON parse error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: alibaba/fastjson
throw new WebApplicationException("Could not write JSON: " + ex.getMessage(), ex);
代码示例来源:origin: com.alibaba/fastjson
/**
* Method that JAX-RS container calls to deserialize given value.
*/
public Object readFrom(Class<Object> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType, //
MultivaluedMap<String, String> httpHeaders, //
InputStream entityStream) throws IOException, WebApplicationException {
try {
FastJsonConfig fastJsonConfig = locateConfigProvider(type, mediaType);
return JSON.parseObject(entityStream,
fastJsonConfig.getCharset(),
genericType,
fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(),
JSON.DEFAULT_PARSER_FEATURE,
fastJsonConfig.getFeatures());
} catch (JSONException ex) {
throw new WebApplicationException("JSON parse error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: com.alibaba/fastjson
throw new WebApplicationException("Could not write JSON: " + ex.getMessage(), ex);
代码示例来源:origin: com.alibaba/fastjson
private Object readType(Type type, HttpInputMessage inputMessage) {
try {
InputStream in = inputMessage.getBody();
return JSON.parseObject(in,
fastJsonConfig.getCharset(),
type,
fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(),
JSON.DEFAULT_PARSER_FEATURE,
fastJsonConfig.getFeatures());
} catch (JSONException ex) {
throw new HttpMessageNotReadableException("JSON parse error: " + ex.getMessage(), ex);
} catch (IOException ex) {
throw new HttpMessageNotReadableException("I/O error while reading input message", ex);
}
}
代码示例来源:origin: com.alibaba/fastjson
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
} finally {
outnew.close();
代码示例来源:origin: egzosn/pay-java-parent
return JSON.parseObject(result, responseType);
} catch (JSONException e) {
throw new PayErrorException(new PayException("failure", String.format("类型转化异常,contentType: %s\n%s", entity.getContentType().getValue(), e.getMessage()), result));
代码示例来源:origin: org.hswebframework.web/hsweb-spring-boot-starter
@ExceptionHandler(JSONException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
ResponseMessage handleException(JSONException exception) {
logger.error(exception.getMessage(), exception);
return ResponseMessage.error(400, "解析JSON失败");
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonString(String indexKeyString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexKeyString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonString(String indexLineString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexLineString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexLine", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void FromJsonString(String indexKeyString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexKeyString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void FromJsonString(String indexKeysString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexKeysString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKeys", e.getMessage(), e, "");
}
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void FromJsonString(String indexLineString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexLineString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexLine", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void FromJsonString(String indexString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndex", e.getMessage(), e, "");
}
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonString(String indexString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndex", e.getMessage(), e, "");
}
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonString(String indexKeysString) throws LogException {
try {
JSONObject dict = JSONObject.parseObject(indexKeysString);
FromJsonObject(dict);
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKeys", e.getMessage(), e, "");
}
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonObject(JSONObject dict) throws LogException {
try {
keys = new HashMap<String, IndexKey>();
@SuppressWarnings("unchecked")
Iterator<String> it = (Iterator<String>) (dict.keySet().iterator());
while (it.hasNext()) {
String key = it.next();
JSONObject value = dict.getJSONObject(key);
IndexKey indexKey = new IndexKey();
indexKey.FromJsonObject(value);
AddKey(key, indexKey);
}
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKeys", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void FromJsonObject(JSONObject dict) throws LogException {
try {
keys = new HashMap<String, IndexKey>();
@SuppressWarnings("unchecked")
Iterator<String> it = (Iterator<String>) (dict.keySet().iterator());
while (it.hasNext()) {
String key = it.next();
JSONObject value = dict.getJSONObject(key);
IndexKey indexKey = new IndexKey();
indexKey.FromJsonObject(value);
AddKey(key, indexKey);
}
} catch (JSONException e) {
throw new LogException("FailToGenerateIndexKeys", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void FromJsonObject(JSONObject dict) throws LogException {
try {
ttl = dict.getIntValue("ttl");
if (dict.containsKey("line")) {
JSONObject lineDict = dict.getJSONObject("line");
line.FromJsonObject(lineDict);
lineSet = true;
}
if (dict.containsKey("keys")) {
JSONObject keysDict = dict.getJSONObject("keys");
keys.FromJsonObject(keysDict);
keysSet = true;
}
if (dict.containsKey("log_reduce")) {
logReduceEnable = dict.getBooleanValue("log_reduce");
}
} catch (JSONException e) {
throw new LogException("FailToGenerateIndex", e.getMessage(), e, "");
}
}
内容来源于网络,如有侵权,请联系作者删除!