Skip to content

Commit 81c2ec3

Browse files
committed
simplify velocity-tool configuration
1 parent 82493f0 commit 81c2ec3

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

org/w3c/css/css/StyleSheetGenerator.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import org.apache.velocity.runtime.RuntimeConstants;
99
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
1010
import org.apache.velocity.tools.ToolManager;
11+
import org.apache.velocity.tools.config.ConfigurationUtils;
12+
import org.apache.velocity.tools.config.FactoryConfiguration;
1113
import org.w3c.css.error.ErrorReportHTML;
1214
import org.w3c.css.parser.CssError;
1315
import org.w3c.css.parser.CssErrorToken;
@@ -84,13 +86,15 @@ public class StyleSheetGenerator extends StyleReport {
8486
}
8587

8688
try {
87-
Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER,
88-
"classpath");
89+
Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
8990
Velocity.setProperty("classpath.resource.loader.class",
9091
ClasspathResourceLoader.class.getName());
9192
Velocity.init();
92-
velocityToolManager = new ToolManager();
93-
velocityToolManager.configure("org/w3c/css/css/velocity-tools.xml");
93+
94+
FactoryConfiguration f;
95+
f = ConfigurationUtils.findInClasspath("org/apache/velocity/tools/generic/tools.xml");
96+
velocityToolManager = new ToolManager(false, false);
97+
velocityToolManager.configure(f);
9498
} catch (Exception e) {
9599
System.err.println("Failed to initialize Velocity. " +
96100
"Validator might not work as expected.");

org/w3c/css/css/velocity-tools.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)