1 19 package org.netbeans.modules.exceptions.web; 20 21 import javax.servlet.jsp.tagext.*; 22 import javax.servlet.jsp.JspWriter ; 23 import javax.servlet.jsp.JspException ; 24 import java.lang.StringBuffer ; 25 import java.util.regex.Pattern ; 26 import org.netbeans.modules.exceptions.entity.Line; 27 28 33 34 public class LineTagHandler extends SimpleTagSupport { 35 36 private Line line; 37 38 42 public void doTag() throws JspException { 43 44 JspWriter out=getJspContext().getOut(); 45 46 try { 47 String methodName = line.getMethod().getName(); 48 Pattern pat = Pattern.compile("\\."); 49 String [] items = pat.split(methodName); 50 int i = items.length-2; 51 if (i<0) i=0; 52 StringBuffer fileName = new StringBuffer (); 53 int s = items[i].indexOf("$"); 54 if (s >= 0) { 55 fileName.append(items[i].substring(0, s)); 56 } else { 57 fileName.append(items[i]); 58 } 59 fileName.append(".java"); 60 61 out.print("at " + methodName); 62 out.print("(" + fileName + ":" + line.getLinePK().getLinenumber() + ")"); 63 64 JspFragment f=getJspBody(); 65 if (f != null) f.invoke(out); 66 67 } catch (java.io.IOException ex) { 68 throw new JspException (ex.getMessage()); 69 } 70 71 } 72 73 public void setLine(Line line) { 74 this.line = line; 75 } 76 } 77 | Popular Tags |