Code example for CharArrayWriter

Methods: toString

    private String generateStackTrace()
        // Get stable reference to work properly with concurrent access 
        CharArrayWriter writer = new CharArrayWriter();
        super.printStackTrace(new PrintWriter(writer));
        String origStackTrace = writer.toString();
        Evaluator e = Context.createInterpreter();
        if (e != null)
            return e.getPatchedStack(this, origStackTrace);
        return null; 
     * Get a string representing the script stack of this exception. 
     * If optimization is enabled, this corresponds to all java stack elements 
     * with a source name ending with ".js". 
     * @return a script stack dump 
     * @since 1.6R6