8
8
import org .apache .velocity .runtime .RuntimeConstants ;
9
9
import org .apache .velocity .runtime .resource .loader .ClasspathResourceLoader ;
10
10
import org .apache .velocity .tools .ToolManager ;
11
- import org .apache .velocity .tools .config .ConfigurationUtils ;
12
- import org .apache .velocity .tools .config .FactoryConfiguration ;
11
+ import org .apache .velocity .tools .generic .EscapeTool ;
13
12
import org .w3c .css .error .ErrorReportHTML ;
14
13
import org .w3c .css .parser .CssError ;
15
14
import org .w3c .css .parser .CssErrorToken ;
27
26
import java .io .FileNotFoundException ;
28
27
import java .io .IOException ;
29
28
import java .io .PrintWriter ;
30
- import java .nio .file .FileSystems ;
31
29
import java .text .SimpleDateFormat ;
32
30
import java .util .ArrayList ;
33
31
import java .util .Collections ;
@@ -92,22 +90,7 @@ public class StyleSheetGenerator extends StyleReport {
92
90
Velocity .setProperty ("classpath.resource.loader.class" ,
93
91
ClasspathResourceLoader .class .getName ());
94
92
Velocity .init ();
95
-
96
- String [] _path_comp = {"org" , "apache" , "velocity" , "tools" , "generic" , "tools.xml" };
97
- StringBuilder sb_path = new StringBuilder ("" );
98
- boolean is_first = true ;
99
- for (String s : _path_comp ) {
100
- if (!is_first ) {
101
- sb_path .append (FileSystems .getDefault ().getSeparator ());
102
- } else {
103
- is_first = false ;
104
- }
105
- sb_path .append (s );
106
- }
107
- FactoryConfiguration f ;
108
- f = ConfigurationUtils .findInClasspath (sb_path .toString ());
109
- velocityToolManager = new ToolManager (false , true );
110
- velocityToolManager .configure (f );
93
+ velocityToolManager = new ToolManager ();
111
94
} catch (Exception e ) {
112
95
System .err .println ("Failed to initialize Velocity. " +
113
96
"Validator might not work as expected." );
@@ -130,6 +113,7 @@ public StyleSheetGenerator(ApplContext ac, String title, StyleSheet style,
130
113
this .template_file = availableFormat .getProperty (document );
131
114
132
115
context = new VelocityContext (velocityToolManager .createContext ());
116
+ context .put ("esc" , new EscapeTool ());
133
117
// add a static ref for templates that needs to do some escaping
134
118
context .put ("Messages" , Messages .class );
135
119
// adjust the source name if needed
0 commit comments