Print the the trace of methods from where the error
originated.  This will trace all nested exception
objects, as well as this object.
@param s The stream where the dump will be sent to.
320033
public void printStackTrace(java.io.PrintStream s) {
        printStackTrace(new java.io.PrintWriter(s));
    }
168245
@Override
    public void printStackTrace(PrintWriter s) {
        s.println(MSG);
        super.printStackTrace(s);
        this.exceptions.forEach((t) -> {
            s.println("Next Exception:");
            t.printStackTrace(s);
        }
330063
public void printJavaString(String s) throws IOException
  {
    for (int i = 0; i < s.length(); i++) {
      char ch = s.charAt(i);

      switch (ch) {
      case '\\':
        _os.print("\\\\");
        break;
      case '\n':
        _os.print("\\n");
        break;
      case '\r':
        _os.print("\\r");
        break;
      case '"':
        _os.print("\\\"");
        break;
      default:
        _os.print(ch);
      }
    }
  }
906763
public void print(String s) throws IOException
	{
		//PK89810, If WCCustomProperties.FINISH_RESPONSE_ON_CLOSE is set and stream is already obtained and closed. 
		// We will not allow user to print more data if the above case is met, outputstreamClosed will be true and default is false.
		if (!(WCCustomProperties.FINISH_RESPONSE_ON_CLOSE) || !outputstreamClosed ) //PK89810
		{
		if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
			logger.logp(Level.FINE, CLASS_NAME,"print", "print --> "+s);
                }
                if(s != null) {  // PQ88872
                    if (!_hasWritten && obs != null)
                    {
                            _hasWritten = true;
            			if (obsList!=null){
            				for (int i=0;i<obsList.size();i++){
            					obsList.get(i).alertFirstWrite();
            				}
            			}
            			else {
                            obs.alertFirstWrite();
                    }
            		}
			int len = s.length();
			if (limit > -1)
			{
				if (total + len > limit)
				{
					len = limit - total;
					except = new WriteBeyondContentLengthException();
				}
			}
			if(this.getBufferSize() != 0){		 // PM44112 
					int off = 0;
					while (len > 0)
					{
						int n = buf.length - count;
						if (n == 0)
						{
							response.setFlushMode(false);
							flushBytes();
							response.setFlushMode(true);
							n = buf.length - count;
						}
						if (n > len)
						{
							n = len;
						}
						//
						// NOTE:  this getBytes call is deprecated ... it doesn't work
						// correctly for multibyte characters, and doesn't take account
						// of the character encoding that the client expects.
						//
						s.getBytes(off, off + n, buf, count);
						
						count += n;
						total += n;
						off += n;
						len -= n;
					}
				} // PM44112 Start
				else if(getBufferSize() == 0) {	
					
					byte[] origBuf=buf; // store the original buff , which is 0
					buf = s.getBytes();	// update buf with the String to print.
					count = buf.length;
					total+=count; // keep the count and the total written
					
					if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
						logger.logp(Level.FINE, CLASS_NAME,"print",  "response Buffersize is set to zero , to print --> "+ count +" total -->"+  total);
					
					
					response.setFlushMode(true);
					flushBytes();				
					buf=origBuf; // set it back to original buff, i.e. 0 value
					
					if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
						logger.logp(Level.FINE, CLASS_NAME,"print",  "after flushbytes, buf --> "+ buf.length +" count --> "+  count+" total -->"+  total);
					
				}// PM44112 End
			check();
		} // PQ88872
	}
		else{//PK89810 start
			if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
				logger.logp(Level.FINE, CLASS_NAME,"print", "print not allowed, outputstreamClosed value --> " + outputstreamClosed);			
		}//PK89810 End
	}
530754
public void printStackTrace(java.io.PrintWriter s)
  {

    if (s == null)
      s = new java.io.PrintWriter(System.err);
        
    try
    {
      super.printStackTrace(s);
    }
    catch (Exception e){}
    
    
    boolean isJdk14OrHigher = false;
    try {
        Throwable.class.getMethod("getCause", (Class<?>) null);
        isJdk14OrHigher = true;
    } catch (NoSuchMethodException nsme) {
        // do nothing
    }
        
    // The printStackTrace method of the Throwable class in jdk 1.4 
    // and higher will include the cause when printing the backtrace.
    // The following code is only required when using jdk 1.3 or lower               
    if (!isJdk14OrHigher) {
    	        
      Throwable exception = m_exception;

      for (int i = 0; (i < 10) && (null != exception); i++)
      {
        s.println("---------");

        try
        {
          exception.printStackTrace(s);
        }
        catch (Exception e)
        {
          s.println("Could not print stack trace...");
        }

        if (exception instanceof TransformerException)
        {
          TransformerException se = (TransformerException) exception;
          Throwable prev = exception;

          exception = se.getException();

          if (prev == exception)
          {
            exception = null;

            break;
          }
        }
        else
        {
          exception = null;
        }
      }
    }
  }
156052
public static RuntimeException codeBug(String msg)
        throws RuntimeException
    {
        msg = "FAILED ASSERTION: " + msg;
        RuntimeException ex = new IllegalStateException(msg);
        // Print stack trace ASAP
        ex.printStackTrace(System.err);
        throw ex;
    }
604026
public void printStackTrace()
    {
        super.printStackTrace();
        for (int i=0;i<LazyList.size(nested);i++)
            ((Throwable)LazyList.get(nested,i)).printStackTrace();
    }
1060296
private final static void printStackTrace(Throwable t, PrintWriter p) {
        if (t == null) {
            p.println("none");
            return;
        }

        // Capture any exceptions while printing stack so we return what we have
        // so far
        try {
            // Print the stack trace of the Throwable.
            t.printStackTrace(p);
        } catch (Throwable e) {
            // Do not throw exception, add a message to PrintWriter and return
            // what we have so far.
            p.println("<Encountered exception while printing stack trace>");
            p.println(e.getClass().getName() + ": " + e.getMessage());
            return;
        }

        // Handle the degenerate case of a TraceException which contains an
        // array of Throwables.
//        if (t instanceof TraceException) {
//            TraceException te = (TraceException) t;
//            Throwable subexs[] = te.getSubexceptions();
//            if (subexs == null)
//                return;
//            for (int i = 0; i < subexs.length; i++) {
//                p.println("----- Begin backtrace for subexception[" + i + "]");
//                printStackTrace(subexs[i], p);
//            }
//            return;
//        }

        // Normal Throwables may contain a single nested Throwable. So this
        // Throwable could be the
        // start of a chain of Throwables. We want to obtain the stack traces of
        // all Throwables in
        // the chain so we can see the entire history, execution path and root
        // exception.
        // Some Throwables that support nesting provide support for
        // automatically walking the chain
        // by providing the appropriate printStackTrace() overrides. Others do
        // not, which means we
        // need to manually walk the chain if we want to obtain all the stack
        // traces.
        // If printStackTrace is called on a Throwable chain that contains
        // Throwables that have
        // overriden printStackTrace, the recursion will end after printing out
        // the stack trace of
        // the first Throwable that does not provide an override. If
        // printStackTrace is called on
        // a chain where the base Throwable does not provide the override, then
        // only the stack trace
        // of the base Throwable will have been printed. Therefore, to obtain
        // the next Throwable that
        // needs its stack trace printed, simply walk the chain starting at the
        // base, find the first
        // Throwable that does not provide an override, then start with that
        // guys nested Throwable.

        // updated to support J2SE1.4's nested Throwables.

        boolean autoRecursion = true;
        Throwable tNext = null;

        // Capture any exceptions while calculating nexted exception so we return what we have
        // so far
        try {
            // Compute tNext - the first Throwable in the stack that doesn't recurse
            // properly
            while (autoRecursion) {

                // all known throwables printStackTrace methods recurse properly
                // when cause is set.
                tNext = t.getCause();
                if (tNext != null) {
                    t = tNext;
                } else {
                    tNext = getNestedThrowable(t);
                    if (tNext == null) {
                        // no cause or nested Throwable - done
                        return;
                    }

                    // some of the known throwables with custom nesting don't
                    // recurse properly
                    if (pstRecursesOnNested(t)) {
                        t = tNext;
                    } else {
                        autoRecursion = false;
                    }
                }

            }
        } catch (Throwable e) {
            // Do not throw exception, add a message to PrintWriter and return
            // what we have so far.
            p.println("<Encountered exception while calculating a nested throwable>");
            p.println(e.getClass().getName() + ": " + e.getMessage());
            try {
                // Try to convert that exception into a stack trace.
                e.printStackTrace(p);
            } catch (Throwable e2) {
                p.println("<Caught exception while printing stack trace from failed nested calculation>");
                p.println(e2.getClass().getName() + ": " + e2.getMessage());
            }
            return;
        }

        // tNext will not be null at this point

        // Have found the first Throwable that doesn't include nested throwable
        // in printStackTrace
        // Obtain the nested Throwable and keep going.
        p.println("---- Begin backtrace for Nested Throwables");
        printStackTrace(tNext, p);

        /*
         * while (pstRecurses(t)) { t = getNestedThrowable(t); if (t == null)
         * return; }
         *
         * // Have found the first Throwable that doesn't override
         * printStackTrace. // Obtain the nested Throwable and keep going. t =
         * getNestedThrowable(t); if (t == null) return;
         * p.println("---- Begin backtrace for Nested Throwables");
         * printStackTrace(t, p);
         */
    }
390403
private static void showErrorMsg(boolean showError, String msgKey, Object[] objs) {
        if (showError) {
            String msg = Tr.formatMessage(TraceSpecification.getTc(), msgKey, objs);
            BaseTraceService.rawSystemErr.println(msg);
        }
    }
555891
public void print(String s) throws IOException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        { // 306998.15
            Tr.debug(tc, "print --> " + s);
        }
        if (!_hasWritten && obs != null)
        {
            _hasWritten = true;
            obs.alertFirstWrite();
        }
        int len = s.length();
        if (limit > -1)
        {
            if (total + len > limit)
            {
                len = (int)(limit - total);
                except = new WriteBeyondContentLengthException();
            }
        }

        int off = 0;
        while (len > 0)
        {
            int n = buf.length - count;
            if (n == 0)
            {
                response.setFlushMode(false);
                flushChars();
                response.setFlushMode(true);
                n = buf.length - count;
            }
            if (n > len)
            {
                n = len;
            }

            s.getChars(off, off + n, buf, count);

            count += n;
            total += n;
            off += n;
            len -= n;
        }
        check();
    }
976719
public void printError() {
    System.out.print(description);
    if (value != null)
      System.out.print(" (" + value + ")");
    System.out.println();
  }
566450
def _print_exception_list(exceptions, message, output_file=None):
    
    output_file = output_file or sys.stderr
    message = 'Exception %s:\n' % message
    for exc_type, exc_value, exc_traceback in exceptions:
        output_file.write(message)
        traceback.print_exception(exc_type, exc_value, exc_traceback,
                                  file=output_file)
        output_file.write('\n')
673476
@Override
    public void trace( F0<Throwable> exception )
    {
        if ( compilerLogger.isDebugEnabled() )
        {
            compilerLogger.debug( exception.apply() );
        }
    }
740860
@Override
    public void error(String msg, Throwable error) {
        try {
            if ((verbose || stacktrace) && error != null) {
                printStackTrace(msg, error);
                error(ERROR, msg);
            } else {
                error(ERROR, msg + STACKTRACE_MESSAGE);
            }
        } finally {
            postPrintMessage();
        }
    }
791796
public void printStackTrace(Throwable e, PrintWriter os)
  {
    CharArrayWriter writer = new CharArrayWriter();
    PrintWriter pw = new PrintWriter(writer);
    
    e.printStackTrace(pw);

    pw.close();
    char []array = writer.toCharArray();

    CharBuffer cb = filter(array);

    if (os != null)
      os.print(cb.toString());
    else
      System.out.println(cb);
  }
715583
public static void printError(Object errorMessage)
	{

		if (errorMessage instanceof Throwable)
		{

			Throwable e = (Throwable) errorMessage;

			getLog(Debugger.class).error(stackTrace(e));

		}
		else
			getLog(Debugger.class).error(errorMessage);

	}
103733
private void log( Level level, String msg, Throwable ex ) {
        if (logger.isLoggable(level)) {
            // Hack (?) to get the stack trace.
            Throwable dummyException=new Throwable();
            StackTraceElement locations[]=dummyException.getStackTrace();
            // Caller will be the third element
            String cname="unknown";
            String method="unknown";
            if( locations!=null && locations.length >2 ) {
                StackTraceElement caller=locations[2];
                cname=caller.getClassName();
                method=caller.getMethodName();
            }
            if( ex==null ) {
                logger.logp( level, cname, method, msg );
            } else {
                logger.logp( level, cname, method, msg, ex );
            }
        }
    }