@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; } } }
@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; } } }
@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; } } }
@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()); } });
/** * 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); } }
/** * 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); } }
/** * 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); } }
e(tag, e.getCause().getMessage() + "\n" + msg); return;
/** * 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); } }