FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(logging): Replace printStackTrace() with proper logging by hobostay · Pull Request #850 · APIJSON/APIJSON · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ public M parseResponse(M request) {
onCommit();
}
catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "onObjectParse failed", e);
error = e;

onRollback();
Expand Down Expand Up @@ -1022,9 +1022,7 @@ public M newErrorResult(Exception e) {
*/
public M newErrorResult(Exception e, boolean isRoot) {
if (e != null) {
// if (Log.DEBUG) {
e.printStackTrace();
// }
Log.e(TAG, "newErrorResult", e);

String msg = CommonException.getMsg(e);
int code = CommonException.getCode(e);
Expand Down Expand Up @@ -1921,7 +1919,7 @@ public static <V extends Object> V getValue(Object parent, String[] pathKeys) {
v = getFromObjOrArr(v, k);
} catch (Throwable e) {
if (IS_PRINT_BIG_LOG) {
e.printStackTrace();
Log.e(TAG, "getFromObjOrArr failed", e);
}
v = null;
}
Expand Down Expand Up @@ -2230,7 +2228,7 @@ && getSQLExecutor().getTransactionIsolation() == Connection.TRANSACTION_NONE) {
commit();
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "onCommit failed", e);
}
}
/**回滚事务
Expand All @@ -2245,12 +2243,12 @@ protected void onRollback() {
rollback();
}
catch (SQLException e1) {
e1.printStackTrace();
Log.e(TAG, "onRollback failed", e1);
try {
rollback(null);
}
catch (SQLException e2) {
e2.printStackTrace();
Log.e(TAG, "onRollback with null failed", e2);
}
}
}
Expand Down Expand Up @@ -2517,7 +2515,7 @@ protected M batchVerify(RequestMethod method, String tag, int version, String na
correctRequest.put(key, obj);
}
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "parseCorrectRequest failed", e);
throw new Exception(e); // 包装一层只是为了打印日志?看起来没必要
}
}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ else if (hasPK) {
rs.close();
}
catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "close ResultSet failed", e);
}
}
}
Expand Down Expand Up @@ -947,7 +947,7 @@ protected void executeAppJoin(SQLConfig<T, M, L> config, List<M> resultList, Map
rs.close();
}
catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "close ResultSet failed in executeAppJoin", e);
}
}
}
Expand Down Expand Up @@ -1125,7 +1125,7 @@ else if (value instanceof Clob) { //SQL Server TEXT 类型 居然走这个
br.close();
}
catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "close BufferedReader failed", e);
}
}

Expand Down Expand Up @@ -1194,7 +1194,7 @@ public boolean isJSONType(@NotNull SQLConfig<T, M, L> config, ResultSetMetaData
return true;
}
} catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "isJsonColumn failed", e);
}
// List<String> json = config.getJson();
// return json != null && json.contains(label);
Expand Down Expand Up @@ -1357,7 +1357,7 @@ public void begin(int transactionIsolation) throws SQLException {
}
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "setAutoCommit failed in rollback", e);
}
}
}
Expand All @@ -1384,7 +1384,7 @@ public void rollback() throws SQLException {
}
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "rollback failed", e);
}
}
}
Expand Down Expand Up @@ -1416,7 +1416,7 @@ public void rollback(Savepoint savepoint) throws SQLException {
}
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "rollback with savepoint failed", e);
}
}
}
Expand All @@ -1442,7 +1442,7 @@ public void commit() throws SQLException {
}
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "commit failed", e);
}
}
}
Expand Down Expand Up @@ -1473,7 +1473,7 @@ public void close() {
}
}
catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "close connection failed", e);
}
}
}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Object put(String key, Object value) {
target = JSON.parse(value);
} catch (Exception e) {
// nothing
e.printStackTrace();
Log.e(TAG, "JSON.parse failed for key: " + key, e);
}
// if (target == null) { // "tag":"User" 报错
// return null;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.script.ScriptEngineManager;
import javax.script.SimpleBindings;

import apijson.Log;
import apijson.orm.AbstractFunctionParser;

/**
Expand Down Expand Up @@ -45,7 +46,7 @@ public void load(String name, String script) {
CompiledScript compiledScript = ((Compilable) scriptEngine).compile(convertScript(script));
compiledScriptMap.put(name, compiledScript);
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "compile script failed: " + name, e);
}

}
Expand Down

Back | FazBrowse Home | New Git URL