1 package com.knowgate.debug; 2 3 import java.io.IOException ; 4 import java.io.PrintWriter ; 5 import java.io.FileOutputStream ; 6 7 13 public class ErrorHandler { 14 15 public ErrorHandler(Throwable ex) { 16 PrintWriter oDebugWriter = null; 17 FileOutputStream oDebugStrm = null; 18 19 try { 20 if (System.getProperty("os.name").startsWith("Windows")) 21 oDebugStrm = new FileOutputStream ("C:\\javatrc.txt", true); 22 else 23 oDebugStrm = new FileOutputStream ("/tmp/javatrc.txt", true); 24 25 oDebugWriter = new PrintWriter (oDebugStrm); 26 27 ex.printStackTrace(oDebugWriter); 28 29 if (null!=oDebugWriter) oDebugWriter.close(); 30 oDebugWriter = null; 31 if (null!=oDebugStrm) oDebugStrm.close(); 32 oDebugStrm = null; 33 34 } 35 catch (IOException ioe) { 36 } 37 } 38 39 } | Popular Tags |