1 17 18 package org.apache.jasper.compiler; 19 20 import org.apache.jasper.JasperException; 21 22 27 class DefaultErrorHandler implements ErrorHandler { 28 29 38 public void jspError(String fname, int line, int column, String errMsg, 39 Exception ex) throws JasperException { 40 throw new JasperException(fname + "(" + line + "," + column + ")" 41 + " " + errMsg, ex); 42 } 43 44 50 public void jspError(String errMsg, Exception ex) throws JasperException { 51 throw new JasperException(errMsg, ex); 52 } 53 54 60 public void javacError(JavacErrorDetail[] details) throws JasperException { 61 62 if (details == null) { 63 return; 64 } 65 66 Object [] args = null; 67 StringBuffer buf = new StringBuffer (); 68 69 for (int i=0; i < details.length; i++) { 70 if (details[i].getJspBeginLineNumber() >= 0) { 71 args = new Object [] { 72 new Integer (details[i].getJspBeginLineNumber()), 73 details[i].getJspFileName() }; 74 buf.append(Localizer.getMessage("jsp.error.single.line.number", 75 args)); 76 buf.append("\n"); 77 } 78 79 buf.append( 80 Localizer.getMessage("jsp.error.corresponding.servlet")); 81 buf.append(details[i].getErrorMessage()); 82 buf.append("\n\n"); 83 } 84 85 throw new JasperException(Localizer.getMessage("jsp.error.unable.compile") + "\n\n" + buf); 86 } 87 88 94 public void javacError(String errorReport, Exception exception) 95 throws JasperException { 96 97 throw new JasperException( 98 Localizer.getMessage("jsp.error.unable.compile"), exception); 99 } 100 101 } 102 | Popular Tags |