You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2016/07/20 15:46:05 UTC
svn commit: r1753538 - in /velocity/engine/trunk: src/changes/changes.xml
velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Author: cbrisson
Date: Wed Jul 20 15:46:05 2016
New Revision: 1753538
URL: http://svn.apache.org/viewvc?rev=1753538&view=rev
Log:
[engine] applied patch from VELOCITY-827
Modified:
velocity/engine/trunk/src/changes/changes.xml
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Modified: velocity/engine/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=1753538&r1=1753537&r2=1753538&view=diff
==============================================================================
--- velocity/engine/trunk/src/changes/changes.xml (original)
+++ velocity/engine/trunk/src/changes/changes.xml Wed Jul 20 15:46:05 2016
@@ -27,6 +27,10 @@
<body>
<release version="2.0" date="In Subversion">
+ <action type="fix" dev="cbrisson" issue="VELOCITY-827" due-to="Dawid Weiss">
+ loading default properties should not prepend '/' and should use classloader to get resource stream
+ </action>
+
<action type="add" dev="cbrisson" issue="VELOCITY-825">
Allow conversion of method args from String to Enum constant
</action>
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1753538&r1=1753537&r2=1753538&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java Wed Jul 20 15:46:05 2016
@@ -435,18 +435,18 @@ public class RuntimeInstance implements
InputStream inputStream = null;
try
{
- inputStream = getClass()
- .getResourceAsStream('/' + DEFAULT_RUNTIME_PROPERTIES);
+ inputStream = getClass().getClassLoader()
+ .getResourceAsStream(DEFAULT_RUNTIME_PROPERTIES);
+
+ if (inputStream == null)
+ throw new IOException("Resource not found: " + DEFAULT_RUNTIME_PROPERTIES);
configuration.load( inputStream );
if (log.isDebugEnabled())
{
- log.debug("Default Properties File: {}",
- new File(DEFAULT_RUNTIME_PROPERTIES).getPath());
+ log.debug("Default Properties resource: {}", DEFAULT_RUNTIME_PROPERTIES);
}
-
-
}
catch (IOException ioe)
{