home *** CD-ROM | disk | FTP | other *** search
/ Popular Software (Premium Edition) / mycd.iso / INTERNET / NETSCAP4.06 / CP32E406.EXE / netcast.z / ncjava10.jar / netscape / palomar / util / Warning.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.5 KB  |  42 lines

  1. package netscape.palomar.util;
  2.  
  3. import java.util.Date;
  4.  
  5. public class Warning extends CascadedException {
  6.    private Date _timeStamp = new Date();
  7.  
  8.    public Warning(int id, Exception e) {
  9.       super(id, e);
  10.    }
  11.  
  12.    public Warning(int id) {
  13.       super(id);
  14.    }
  15.  
  16.    public String toString() {
  17.       StringBuffer res = new StringBuffer("Warning: ");
  18.       res.append(((CascadedException)this).getTextForId(super.errorID));
  19.       res.append("\n");
  20.       res.append(this._timeStamp.toString());
  21.       if (super.previous != null) {
  22.          res.append("\n    exception caught:\n");
  23.          res.append(super.previous.toString());
  24.       }
  25.  
  26.       return res.toString();
  27.    }
  28.  
  29.    public String getOneLiner() {
  30.       return this._timeStamp.toString() + ": " + ((CascadedException)this).getTextForId(super.errorID);
  31.    }
  32.  
  33.    protected String lookup(int id) {
  34.       switch (id) {
  35.          case 0:
  36.             return "Unspecified Warning ($msg)";
  37.          default:
  38.             return "Warning " + id + " ($msg)";
  39.       }
  40.    }
  41. }
  42.