1 7 8 package javax.script; 9 10 20 public class ScriptException extends Exception { 21 22 private String fileName; 23 private int lineNumber; 24 private int columnNumber; 25 26 32 public ScriptException(String s) { 33 super(s); 34 fileName = null; 35 lineNumber = -1; 36 columnNumber = -1; 37 } 38 39 45 public ScriptException(Exception e) { 46 super(e); 47 fileName = null; 48 lineNumber = -1; 49 columnNumber = -1; 50 } 51 52 64 public ScriptException(String message, String fileName, int lineNumber) { 65 super(message); 66 this.fileName = fileName; 67 this.lineNumber = lineNumber; 68 this.columnNumber = -1; 69 } 70 71 79 public ScriptException(String message, 80 String fileName, 81 int lineNumber, 82 int columnNumber) { 83 super(message); 84 this.fileName = fileName; 85 this.lineNumber = lineNumber; 86 this.columnNumber = columnNumber; 87 } 88 89 94 public String getMessage() { 95 String ret = super.getMessage(); 96 if (fileName != null) { 97 ret += (" in " + fileName); 98 if (lineNumber != -1) { 99 ret += " at line number " + lineNumber; 100 } 101 102 if (columnNumber != -1) { 103 ret += " at column number " + columnNumber; 104 } 105 } 106 107 return ret; 108 } 109 110 114 public int getLineNumber() { 115 return lineNumber; 116 } 117 118 122 public int getColumnNumber() { 123 return columnNumber; 124 } 125 126 132 public String getFileName() { 133 return fileName; 134 } 135 } 136 | Popular Tags |