Author: scabanovich
Date: 2012-01-18 19:53:49 -0500 (Wed, 18 Jan 2012)
New Revision: 37962
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/TemplatePreprocessor.java
Log:
JBIDE-10639
https://issues.joss.org/browse/JBIDE-10639
Start velocity with context class loader set to current class loader.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/TemplatePreprocessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/TemplatePreprocessor.java 2012-01-19
00:53:11 UTC (rev 37961)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/TemplatePreprocessor.java 2012-01-19
00:53:49 UTC (rev 37962)
@@ -65,7 +65,12 @@
File sourceFile = new File(sourceDir, path);
File targetFile = new File(targetDir, path);
if(!sourceFile.exists()) return;
+
+ ClassLoader c = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ try {
+
Properties properties = new Properties();
properties.put("file.resource.loader.path", sourceDir.getCanonicalPath());
//$NON-NLS-1$
String logFileName =
Platform.getLocation().append(".metadata").append(".plugins").append(WebUiPlugin.PLUGIN_ID).append("velocity.log").toFile().getAbsolutePath();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -93,5 +98,9 @@
writer.flush();
writer.close();
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(c);
+ }
}
}
\ No newline at end of file