本文整理汇总了Java中org.json.simple.parser.ParseException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ParseException.getMessage方法的具体用法?Java ParseException.getMessage怎么用?Java ParseException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.json.simple.parser.ParseException
的用法示例。
在下文中一共展示了ParseException.getMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKarma
import org.json.simple.parser.ParseException; //导入方法依赖的package包/类
/**
* Gets your karma
* @return The requestResponse of type JodelRequestResponse
*/
public JodelRequestResponse getKarma() {
JodelRequestResponse requestResponse = new JodelRequestResponse();
this.updateHTTPParameter();
JodelHTTPResponse karmaResponse = this.httpAction.getKarma();
requestResponse.httpResponseCode = karmaResponse.responseCode;
if (requestResponse.httpResponseCode == 200) {
String responseKarma = karmaResponse.responseMessage;
requestResponse.rawResponseMessage = responseKarma;
JSONParser parserCaptcha = new JSONParser();
try {
JSONObject responseCaptchaJson = (JSONObject) parserCaptcha.parse(responseKarma);
String karma = responseCaptchaJson.get("karma").toString();
requestResponse.responseValues.put("karma", karma);
} catch (ParseException e) {
requestResponse.rawErrorMessage = e.getMessage();
e.printStackTrace();
requestResponse.error = true;
requestResponse.errorMessage = "Could not parse response JSON!";
}
} else {
requestResponse.error = true;
}
return requestResponse;
}
示例2: jsonParse
import org.json.simple.parser.ParseException; //导入方法依赖的package包/类
/**
* Convenience method that JSON Parses the <code>InputStream</code> of a
* <code>HttpURLConnection</code>.
*
* @param conn the <code>HttpURLConnection</code>.
*
* @return the parsed JSON object.
*
* @throws IOException thrown if the <code>InputStream</code> could not be
* JSON parsed.
*/
static Object jsonParse(HttpURLConnection conn) throws IOException {
try {
JSONParser parser = new JSONParser();
return parser.parse(new InputStreamReader(conn.getInputStream(), Charsets.UTF_8));
} catch (ParseException ex) {
throw new IOException("JSON parser error, " + ex.getMessage(), ex);
}
}