lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/logger/api/LogPersister.java
private static JSONObject appendFullStackTrace (JSONObject jsonMetadata, Throwable t) {
        JSONArray stackArray = new JSONArray();

        Throwable throwable = t;

        StackTraceElement[] stackTraceElements;

        boolean first = true;

        // walk up the throwable's call stack:
        while (throwable != null) {
            stackArray.put((first ? "Exception " : "Caused by: ") + throwable.getClass().getName() + (throwable.getMessage() != null ? ": " + throwable.getMessage() : ""));

            stackTraceElements = throwable.getStackTrace();

            for (int i = 0; i < stackTraceElements.length; i++) {
                stackArray.put(stackTraceElements[i].toString());
            }

            throwable = throwable.getCause();

            first = false;
        }

        try {
            if (null == jsonMetadata) {
                jsonMetadata = new JSONObject();
            }
            jsonMetadata.put("$stacktrace", stackArray);
            jsonMetadata.put("$exceptionMessage", t.getLocalizedMessage ());
            jsonMetadata.put ("$exceptionClass", t.getClass().getName());
        }
        catch (JSONException e) {
            // ignore.  getting the stacktrace is best effort
        }
        return jsonMetadata;
    }
private static JSONObject appendFullStackTrace (JSONObject jsonMetadata, Throwable t) {
        JSONArray stackArray = new JSONArray();

        Throwable throwable = t;

        StackTraceElement[] stackTraceElements;

        boolean first = true;

        // walk up the throwable's call stack:
        while (throwable != null) {
            stackArray.put((first ? "Exception " : "Caused by: ") + throwable.getClass().getName() + (throwable.getMessage() != null ? ": " + throwable.getMessage() : ""));

            stackTraceElements = throwable.getStackTrace();

            for (int i = 0; i < stackTraceElements.length; i++) {
                stackArray.put(stackTraceElements[i].toString());
            }

            throwable = throwable.getCause();

            first = false;
        }

        try {
            if (null == jsonMetadata) {
                jsonMetadata = new JSONObject();
            }
            jsonMetadata.put("$stacktrace", stackArray);
            jsonMetadata.put("$exceptionMessage", t.getLocalizedMessage ());
            jsonMetadata.put ("$exceptionClass", t.getClass().getName());
        }
        catch (JSONException e) {
            // ignore.  getting the stacktrace is best effort
        }
        return jsonMetadata;
    }
private static JSONObject appendFullStackTrace ( JSONObject jsonMetadata , Throwable t ) { JSONArray stackArray = new JSONArray ( ) ; Throwable throwable = t ; StackTraceElement [ ] stackTraceElements ; boolean first = true ; // walk up the throwable's call stack: while ( throwable != null ) { stackArray . put ( ( first ? "Exception " : "Caused by: " ) + throwable . getClass ( ) . getName ( ) + ( throwable . getMessage ( ) != null ? ": " + throwable . getMessage ( ) : "" ) ) ; stackTraceElements = throwable . getStackTrace ( ) ; for ( int i = 0 ; i < stackTraceElements . length ; i ++ ) { stackArray . put ( stackTraceElements [ i ] . toString ( ) ) ; } throwable = throwable . getCause ( ) ; first = false ; } try { if ( null == jsonMetadata ) { jsonMetadata = new JSONObject ( ) ; } jsonMetadata . put ( "$stacktrace" , stackArray ) ; jsonMetadata . put ( "$exceptionMessage" , t . getLocalizedMessage ( ) ) ; jsonMetadata . put ( "$exceptionClass" , t . getClass ( ) . getName ( ) ) ; } catch ( JSONException e ) { // ignore.  getting the stacktrace is best effort } return jsonMetadata ; }
append the full stacktrace to a $stacktrace key JSONArray in the passed jsonMetadata object
and return it.
append the full stacktrace to a $stacktrace key JSONArray in the passed jsonMetadata object and return it .