本文整理匯總了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);
}
}