javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java
changeset 79 2f468c1958d0
parent 76 4ad59aaee882
child 80 d6dafc5d983f
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
    57         _closeThreadDumper();
    57         _closeThreadDumper();
    58     }
    58     }
    59 
    59 
    60     public static String getStackTrace(Throwable t)
    60     public static String getStackTrace(Throwable t)
    61     {
    61     {
    62         if (t == null)
    62         String res = null;
       
    63         if (t != null)
    63         {
    64         {
    64             throw new NullPointerException("Null when getting stack trace");
    65             try 
       
    66             {
       
    67                 ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
    68                 _getStackTrace(t, new PrintStream(baos));
       
    69                 res = baos.toString();
       
    70             }
       
    71             catch (Throwable t2)
       
    72             {
       
    73                 System.err.println("Failure in getting stack trace.");
       
    74                 t2.printStackTrace();
       
    75             }
    65         }
    76         }
    66         ByteArrayOutputStream baos = new ByteArrayOutputStream();
    77         return res;
    67         _getStackTrace(t, new PrintStream(baos));
       
    68         return baos.toString();
       
    69     }
    78     }
    70 
    79 
    71     private static native void _getStackTrace(Throwable t, PrintStream printStream);
    80     private static native void _getStackTrace(Throwable t, PrintStream printStream);
    72 
    81 
    73     private static native void _doThreadDump();
    82     private static native void _doThreadDump();