pengecualian java untuk string

public static String readStackTrace(Throwable exception) {
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);

        try {
            exception.printStackTrace(printWriter);
        } catch (Throwable var6) {
            try {
                printWriter.close();
            } catch (Throwable var5) {
                var6.addSuppressed(var5);
            }

            throw var6;
        }

        printWriter.close();
        return stringWriter.toString();
    }
Red Team