org.starhope.appius.game
Class BugReporter

java.lang.Object
  extended by org.starhope.appius.game.BugReporter

public class BugReporter
extends Object

WRITEME: Document this type.

Author:
brpocock@star-hope.org

Field Summary
private  String bugPrelude
          WRITEME: Document this brpocock@star-hope.org
private static Set<Long> bugsMailed
          when were bugs eMailed? Don't blow up my mailbox
private  String confPrefix
          WRITEME: Document this brpocock@star-hope.org
private  javax.mail.Address mailFrom
          WRITEME: Document this brpocock@star-hope.org
private  javax.mail.Address mailTo
          WRITEME: Document this brpocock@star-hope.org
private  String purpose
          WRITEME: Document this brpocock@star-hope.org
private static Map<String,BugReporter> reporters
          WRITEME: Document this brpocock@star-hope.org
private  String subjectTagline
          WRITEME: Document this brpocock@star-hope.org
 
Constructor Summary
private BugReporter(String newPurpose)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 void bugDuplex(String subject, String message)
          WRITEME: Document this method brpocock@star-hope.org
 Error fatalBug(Exception e)
          WRITEME: Document this method brpocock@star-hope.org
 Error fatalBug(String string, Throwable t)
          WRITEME: Document this method brpocock@star-hope.org
 String getBugPrelude()
           
 javax.mail.Address getMailFrom()
          WRITEME: Document this method brpocock@star-hope.org
 javax.mail.Address getMailTo()
           
private  String getPurpose()
           
static BugReporter getReporter(String purpose)
          Get a bug reporter instance for a certain type of bugs.
(package private) static String getStackTrace(Throwable throwable)
           This extracts a stack backtrace from a Throwable into a string format for a bug report.
(package private) static String getStackTrace(Throwable throwable, String prefix)
          This extracts a stack backtrace from a Throwable into a string format for a bug report.
 String getSubjectTagline()
           
 void reportBug(Exception e)
          WRITEME: Document this method brpocock@star-hope.org
 void reportBug(String message)
          WRITEME: Document this method brpocock@star-hope.org
 void reportBug(String string, boolean b)
           WRITEME: Document this method brpocock@star-hope.org
 void reportBug(String reason, Thread thread)
          WRITEME: Document this method brpocock@star-hope.org
 void reportBug(String reason, Throwable throwable)
          Report a bug to the automatic bug-tracking systems.
private  void sendBugReport(String subject, String message)
          Send a bug report via eMail.
 void setBugPrelude(String newPrelude)
           
 void setMailFrom(String newMailFrom)
          WRITEME: Document this method brpocock@star-hope.org
 void setMailTo(String newMail)
           
 void setSubjectTagline(String newTagline)
           
private  boolean tooManyBugsMailed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reporters

private static final Map<String,BugReporter> reporters
WRITEME: Document this brpocock@star-hope.org


mailTo

private javax.mail.Address mailTo
WRITEME: Document this brpocock@star-hope.org


subjectTagline

private String subjectTagline
WRITEME: Document this brpocock@star-hope.org


bugPrelude

private String bugPrelude
WRITEME: Document this brpocock@star-hope.org


confPrefix

private final String confPrefix
WRITEME: Document this brpocock@star-hope.org


bugsMailed

private static Set<Long> bugsMailed
when were bugs eMailed? Don't blow up my mailbox


mailFrom

private javax.mail.Address mailFrom
WRITEME: Document this brpocock@star-hope.org


purpose

private final String purpose
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

BugReporter

private BugReporter(String newPurpose)
             throws NotFoundException,
                    javax.mail.internet.AddressException
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
newPurpose - WRITEME
Throws:
NotFoundException - WRITEME
javax.mail.internet.AddressException - if the addresses given for “from” or “to” fail to parse
Method Detail

getReporter

public static BugReporter getReporter(String purpose)
Get a bug reporter instance for a certain type of bugs. Generally-expected strings include:
srv
Server-related bugs: problems inside of Appius Claudius Caecus or its local processes
net
Network-outage-type bugs, like DNS failures, that should go to a systems operator
client
Bugs reported by an accessing client application. XXX: allow clients to report their identification so that this can be split up
design
Bugs found in design-related data, such as bad strings in room variables, missing exit spaces

Parameters:
purpose - what kind of bugs are we reporting? see above.
Returns:
a bug reporter for those bugs

getStackTrace

static String getStackTrace(Throwable throwable)

This extracts a stack backtrace from a Throwable into a string format for a bug report. Each line is tagged with a leading "/#" string, followed by a space, the stack backtrace element, and a newline.

This is the same as calling getStackTrace(Throwable, String) with a prefix of "\n/#"

Parameters:
throwable - The Throwable containing stack backtrace data
Returns:
A string representation of the backtrace, suitable for logging or bug reports.

getStackTrace

static String getStackTrace(Throwable throwable,
                            String prefix)
This extracts a stack backtrace from a Throwable into a string format for a bug report. Each line is preceded by the supplied prefix string, followed the stack backtrace element. The string does not end with a newline.

Parameters:
throwable - A Throwable from which to extract a stack trace
prefix - The string with which to separate lines of the trace.
Returns:
The stacktrace as a string

bugDuplex

public void bugDuplex(String subject,
                      String message)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
subject - WRITEME
message - WRITEME

fatalBug

public Error fatalBug(Exception e)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
e - WRITEME
Returns:
WRITEME

fatalBug

public Error fatalBug(String string,
                      Throwable t)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
string - WRITEME
t - WRITEME
Returns:
WRITEME

getBugPrelude

public String getBugPrelude()
Returns:
the bugPrelude

getMailFrom

public javax.mail.Address getMailFrom()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getMailTo

public javax.mail.Address getMailTo()
Returns:
the mailTo

getPurpose

private String getPurpose()
Returns:
the purpose for which this BugReporter instance was created. Typically “srv,” “net,” or “client”

getSubjectTagline

public String getSubjectTagline()
Returns:
the subjectTagline

reportBug

public void reportBug(Exception e)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
e - WRITEME

reportBug

public void reportBug(String message)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
message - WRITEME

reportBug

public void reportBug(String string,
                      boolean b)

WRITEME: Document this method brpocock@star-hope.org

TODO, implement

Parameters:
string - WRITEME
b - WRITEME

reportBug

public void reportBug(String reason,
                      Thread thread)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
reason - the message content
thread - the thread throwing the exception

reportBug

public void reportBug(String reason,
                      Throwable throwable)
Report a bug to the automatic bug-tracking systems. This is an exception which "should never" be thrown, being caught and referred back for programmer intervention.

Parameters:
reason - The reason this is a bug, if known.
throwable - The "impossible" exception.

sendBugReport

private void sendBugReport(String subject,
                           String message)
Send a bug report via eMail. Must be toggled on in the configuration. Do not call this method directly: just report the bug via Appius Claudius Caecus, and (if configured to do so) it will relay the message through this method.

Parameters:
subject - The subject of the mail message
message - The stack trace and associated details involved.

setBugPrelude

public void setBugPrelude(String newPrelude)
Parameters:
newPrelude - the bugPrelude to set

setMailFrom

public void setMailFrom(String newMailFrom)
                 throws javax.mail.internet.AddressException
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newMailFrom - WRITEME
Throws:
javax.mail.internet.AddressException - WRITEME

setMailTo

public void setMailTo(String newMail)
               throws javax.mail.internet.AddressException
Parameters:
newMail - the mailTo to set
Throws:
javax.mail.internet.AddressException - WRITEME

setSubjectTagline

public void setSubjectTagline(String newTagline)
Parameters:
newTagline - the subjectTagline to set

tooManyBugsMailed

private boolean tooManyBugsMailed()
Returns:
true, if I'm getting my mailbox blown up