[ 
https://issues.apache.org/jira/browse/WW-5383?focusedWorklogId=897881&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-897881
 ]

ASF GitHub Bot logged work on WW-5383:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Jan/24 13:14
            Start Date: 03/Jan/24 13:14
    Worklog Time Spent: 10m 
      Work Description: sepe81 commented on code in PR #830:
URL: https://github.com/apache/struts/pull/830#discussion_r1440439457


##########
plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java:
##########
@@ -438,30 +471,26 @@ private UrlSet buildUrlSet(List<URL> resourceUrls) throws 
IOException {
         }
 
         //try to find classes dirs inside war files
-        urlSet = urlSet.includeClassesUrl(classLoaderInterface, new 
UrlSet.FileProtocolNormalizer() {
-            public URL normalizeToFileProtocol(URL url) {
-                return fileManager.normalizeToFileProtocol(url);
-            }
-        });
-
+        urlSet = urlSet.includeClassesUrl(classLoaderInterface, url -> 
fileManager.normalizeToFileProtocol(url));
 
         urlSet = urlSet.excludeJavaExtDirs()
-                    .excludeJavaEndorsedDirs()
-                    .excludeUserExtensionsDir();
+            .excludeJavaEndorsedDirs()
+            .excludeUserExtensionsDir();
 
         try {
-               urlSet = urlSet.excludeJavaHome();
+            urlSet = urlSet.excludeJavaHome();
         } catch (NullPointerException e) {
-               // This happens in GAE since the sandbox contains no java.home 
directory
-           LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?");
+            // This happens in GAE since the sandbox contains no java.home 
directory
+            LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?");
         }
         urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", 
""));
         urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
 
         if (includeJars == null) {
-            urlSet = urlSet.exclude(".*?\\.jar(!/|/)?");
+            LOG.debug("\"{}\" is not defined, excluding all JAR files!", 
ConventionConstants.CONVENTION_ACTION_INCLUDE_JARS);
+            urlSet = urlSet.exclude(EXCLUDE_ALL_JARS_PATTERN);

Review Comment:
   I guess the extra `(.*)?` from `EXCLUDE_ALL_JARS_PATTERN = 
".*?\\.jar(!/|/)?(.*)?";` is intentional, isn't it?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 897881)
    Time Spent: 1h 10m  (was: 1h)

> Exclude JAR files by default when scanning for actions on JDK9+
> ---------------------------------------------------------------
>
>                 Key: WW-5383
>                 URL: https://issues.apache.org/jira/browse/WW-5383
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Convention
>            Reporter: Lukasz Lenart
>            Priority: Minor
>             Fix For: 6.4.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> When running an app on the JDK9+ it can happen that the Convention plugin 
> starts scanning JAR files due to changed behaviour of 
> {{getClassLoader().getResources("")}} as this will also return additional 
> path and current pattern to exclude JARs won't work.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to