1 package org.apache.velocity.runtime.directive; 2 3 18 19 import java.util.Stack ; 20 21 27 public class ParseDirectiveException extends Exception 28 { 29 private Stack filenameStack = new Stack (); 30 private String msg = ""; 31 private int depthCount = 0; 32 33 36 ParseDirectiveException( String m, int i ) 37 { 38 msg = m; 39 depthCount = i; 40 } 41 42 45 public String getMessage() 46 { 47 String returnStr = "#parse() exception : depth = " + 48 depthCount + " -> " + msg; 49 50 returnStr += " File stack : "; 51 52 try 53 { 54 while( !filenameStack.empty()) 55 { 56 returnStr += (String ) filenameStack.pop(); 57 returnStr += " -> "; 58 } 59 } 60 catch( Exception e) 61 { 62 } 63 64 return returnStr; 65 } 66 67 70 public void addFile( String s ) 71 { 72 filenameStack.push( s ); 73 } 74 75 } 76 | Popular Tags |