arkanovicz commented on code in PR #51:
URL: https://github.com/apache/velocity-engine/pull/51#discussion_r1746627376


##########
spring-velocity-support/src/main/java/org/apache/velocity/spring/SpringResourceLoader.java:
##########
@@ -91,8 +91,8 @@ public void init(ExtProperties configuration) {
                }
        }
        if (logger.isInfoEnabled()) {
-               logger.info("SpringResourceLoader for Velocity: using resource 
loader [" + this.resourceLoader +
-                               "] and resource loader paths " + 
Arrays.asList(this.resourceLoaderPaths));
+               logger.info("SpringResourceLoader for Velocity: using resource 
loader [{}] and resource loader paths {}",
+                       resourceLoader, 
Arrays.asList(this.resourceLoaderPaths));

Review Comment:
   There is a mix of tabs and spaces for indentation. We use four spaces. Is it 
possible to fix this?



##########
spring-velocity-support/src/main/java/org/apache/velocity/spring/VelocityEngineFactory.java:
##########
@@ -259,41 +281,61 @@ protected VelocityEngine newVelocityEngine() throws 
IOException, VelocityExcepti
      */
     protected void initVelocityResourceLoader(VelocityEngine velocityEngine, 
String resourceLoaderPath) {
        if (isPreferFileSystemAccess()) {
+           
+           // Only used with enhanced processing.
+            final List<String> filePaths = new ArrayList<>();
+            final List<String> nonFilePaths = new ArrayList<>();
+
+            String[] paths = 
StringUtils.commaDelimitedListToStringArray(resourceLoaderPath);
+
                // Try to load via the file system, fall back to 
SpringResourceLoader
                // (for hot detection of template changes, if possible).
-               try {
-                       StringBuilder resolvedPath = new StringBuilder();
-                       String[] paths = 
StringUtils.commaDelimitedListToStringArray(resourceLoaderPath);
-                       for (int i = 0; i < paths.length; i++) {
-                               String path = paths[i];
+                       for (int i = 0; i < paths.length; i++) {
+                               String path = paths[i];
+                               
+                // Don't check classpath: locations, they're not file-based.
+                // Some containers will expand jars and trigger false 
positives.
+                               // If enhanced behavior isn't on, this will 
fall into the usual code it did before.
+                if (isSupportClasspathEnhancements() && 
path.startsWith(ResourceLoader.CLASSPATH_URL_PREFIX)) {

Review Comment:
   How should it be configured on the Spring side? Is it worth creating a 
`spring.support_classpath_enhancements` Velocity property that could be read 
here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to