Clover coverage report - clover
Coverage timestamp: Sat Oct 8 2005 22:54:17 EDT
file stats: LOC: 59   Methods: 5
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BugReport.java 50% 75% 100% 78.9%
coverage coverage
 1   
 package abbot;
 2   
 
 3   
 import java.io.*;
 4   
 import abbot.tester.Robot;
 5   
 import abbot.i18n.Strings;
 6   
 
 7   
 /** Exception for reporting unexpected situations in the program.
 8   
  * Automatically generates a message suitable for posting in a bug report.
 9   
  */
 10   
 public class BugReport extends Error implements Version {
 11   
 
 12   
     private static final String LS = System.getProperty("line.separator");
 13   
 
 14   
     private static final String BUGREPORT_URL = Strings.get("bugreport.url");
 15   
 
 16  288
     private static String getReportingInfo() {
 17  288
         return Strings.get("bugreport.info",
 18   
                            new Object[] { LS + BUGREPORT_URL + LS });
 19   
     }
 20   
 
 21  288
     public static String getSystemInfo() {
 22  288
         return ""
 23   
             + "abbot version: " + VERSION + LS
 24   
             + "         mode: " + Robot.getEventModeDescription() + LS
 25   
             + "           OS: " + System.getProperty("os.name")
 26   
             + " " + System.getProperty("os.version") 
 27   
             + " (" + System.getProperty("os.arch") + ") " + LS
 28   
             + " Java version: " + System.getProperty("java.version") 
 29   
             + " (vm " + System.getProperty("java.vm.version") + ")" + LS
 30   
             + "    Classpath: " + System.getProperty("java.class.path");
 31   
     }
 32   
 
 33   
     private String errorMessage;
 34   
     private Throwable throwable;
 35   
 
 36  288
     public BugReport(String error) {
 37  288
         this(error, null);
 38   
     }
 39   
 
 40  288
     public BugReport(String error, Throwable thr) {
 41  288
         super(error);
 42  288
         this.errorMessage = error;
 43  288
         this.throwable = thr;
 44   
     }
 45   
 
 46  288
     public String toString() {
 47  288
         String exc = "";
 48  288
         if (throwable != null) {
 49  0
             StringWriter writer = new StringWriter();
 50  0
             throwable.printStackTrace(new PrintWriter(writer));
 51  0
             exc = writer.toString();
 52   
         }
 53  288
         return errorMessage
 54   
             + LS + getReportingInfo()
 55   
             + LS + getSystemInfo()
 56   
             + LS + exc;
 57   
     }
 58   
 }
 59