Re: [PR] Proposed conditional patch to address VELOCITY-943 [velocity-engine]

scantor (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.devel
Message-ID <PR_kwDOAN72MM56Shck-17b65c0e-4fa5-43e8-bdf3-d13cef63a640@gitbox.apache.org>
scantor commented on code in PR #51:
URL: https://github.com/apache/velocity-engine/pull/51#discussion_r1747512281


##########
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:
   Patch is modified without the new flag, and I fixed up some javadoc nits.
   
   If this is accepted, I can do some testing with my project pointing to a snapshot if it's accessible in a Maven repo.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.