1 36 package org.columba.ristretto.parser; 37 38 43 public class ParserException extends Exception { 44 45 48 private static final long serialVersionUID = 1L; 49 protected CharSequence source; 50 51 54 public ParserException() { 55 super(); 56 } 57 58 63 public ParserException(String message) { 64 super(message); 65 } 66 67 73 public ParserException(String message, CharSequence source) { 74 super(message); 75 this.source = source; 76 } 77 78 84 public ParserException(String message, Throwable cause) { 85 super(message, cause); 86 } 87 88 93 public ParserException(Throwable cause) { 94 super(cause); 95 } 96 97 100 public CharSequence getSource() { 101 return source; 102 } 103 104 107 public void setSource(CharSequence source) { 108 this.source = source; 109 } 110 111 114 public String getMessage() { 115 StringBuffer buffer = new StringBuffer (); 116 String message = super.getMessage(); 117 if (message != null) { 118 buffer.append(message); 119 buffer.append('\n'); 120 } 121 buffer.append("Source: "); 122 buffer.append(source); 123 return buffer.toString(); 124 } 125 } 126 | Popular Tags |