本文整理了Java中org.json.JSONException.getCause()
方法的一些代码示例,展示了JSONException.getCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONException.getCause()
方法的具体详情如下:
包路径:org.json.JSONException
类名称:JSONException
方法名:getCause
[英]Returns the cause of this exception or null if the cause is nonexistent or unknown.
[中]返回此异常的原因,如果原因不存在或未知,则返回null。
代码示例来源:origin: org.restlet.jse/org.restlet.ext.json
@Override
public void write(Writer writer) throws IOException {
try {
writer.write(getJsonText());
} catch (JSONException e) {
IOException ioe = new IOException(e.getLocalizedMessage());
ioe.initCause(e.getCause());
throw ioe;
}
}
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.json
@Override
public void write(Writer writer) throws IOException {
try {
writer.write(getJsonText());
} catch (JSONException e) {
IOException ioe = new IOException(e.getLocalizedMessage());
ioe.initCause(e.getCause());
throw ioe;
}
}
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
@Override
public void write(Writer writer) throws IOException {
try {
writer.write(getJsonText());
} catch (JSONException e) {
IOException ioe = new IOException(e.getLocalizedMessage());
ioe.initCause(e.getCause());
throw ioe;
}
}
}
代码示例来源:origin: iflove/Logcat
@Override
public void run() {
String indentJSON = null;
try {
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
indentJSON = jsonObject.toString(JSON_INDENT);
} else if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
indentJSON = jsonArray.toString(JSON_INDENT);
}
} catch (JSONException e) {
e("JSONException/" + tag, e.getCause().getMessage() + LINE_SEPARATOR + json);
return;
}
jLog.println(stringBuilder.append(tag).append(logStr).append(LINE_SEPARATOR).append(indentJSON).append(LINE_SEPARATOR).toString());
}
});
代码示例来源:origin: lfkdsk/JustWeEngine
/**
* Formats the json content and print it
*
* @param json the json content
*/
@Override
public void json(String json) {
if (TextUtils.isEmpty(json)) {
d("Empty/Null json content");
return;
}
try {
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
String message = jsonObject.toString(JSON_INDENT);
d(message);
return;
}
if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
String message = jsonArray.toString(JSON_INDENT);
d(message);
}
} catch (JSONException e) {
e(e.getCause().getMessage() + "\n" + json);
}
}
代码示例来源:origin: laucherish/PureZhihuD
/**
* Formats the json content and print it
*
* @param json the json content
*/
@Override
public void json(String json) {
if (TextUtils.isEmpty(json)) {
d("Empty/Null json content");
return;
}
try {
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
String message = jsonObject.toString(JSON_INDENT);
d(message);
return;
}
if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
String message = jsonArray.toString(JSON_INDENT);
d(message);
}
} catch (JSONException e) {
e(e.getCause().getMessage() + "\n" + json);
}
}
代码示例来源:origin: CankingApp/XiaomiPJ
/**
* Formats the json content and print it
*
* @param json the json content
*/
@Override
public void json(String json) {
if (TextUtils.isEmpty(json)) {
d("Empty/Null json content");
return;
}
try {
json = json.trim();
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
String message = jsonObject.toString(JSON_INDENT);
d(message);
return;
}
if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
String message = jsonArray.toString(JSON_INDENT);
d(message);
}
} catch (JSONException e) {
e(e.getCause().getMessage() + "\n" + json);
}
}
代码示例来源:origin: misakuo/Dream-Catcher
e(tag, e.getCause().getMessage() + "\n" + msg);
return;
代码示例来源:origin: GuoFeilong/LifeHelper
/**
* Formats the json content and print it
*
* @param json the json content
* @param methodCount number of the method that will be printed
*/
public static void json(String tag, String json, int methodCount) {
validateMethodCount(methodCount);
if (TextUtils.isEmpty(json)) {
d(tag, "Empty/Null json content", methodCount);
return;
}
try {
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
String message = jsonObject.toString(JSON_INDENT);
d(tag, message, methodCount);
return;
}
if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
String message = jsonArray.toString(JSON_INDENT);
d(tag, message, methodCount);
}
} catch (JSONException e) {
d(tag, e.getCause().getMessage() + "\n" + json, methodCount);
}
}
内容来源于网络,如有侵权,请联系作者删除!