elharo commented on a change in pull request #18: [MCHECKSTYLE-381] remove call 
to checker.setClassLoader().
URL: 
https://github.com/apache/maven-checkstyle-plugin/pull/18#discussion_r385093627
 
 

 ##########
 File path: 
src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
 ##########
 @@ -316,6 +258,73 @@ public URLClassLoader run()
         return checkerListener.getResults();
     }
 
+    private void setUpCheckstyleClassloader( Checker checker,
+                                             List<String> classPathStrings,
+                                             List<String> outputDirectories )
+        throws CheckstyleExecutorException
+    {
+        final List<URL> urls = new ArrayList<>( classPathStrings.size() );
+
+        for ( String path : classPathStrings )
+        {
+            try
+            {
+                urls.add( new File( path ).toURI().toURL() );
+            }
+            catch ( MalformedURLException e )
+            {
+                throw new CheckstyleExecutorException( e.getMessage(), e );
+            }
+        }
+
+        for ( String outputDirectoryString : outputDirectories )
+        {
+            try
+            {
+                if ( outputDirectoryString != null )
+                {
+                    File outputDirectoryFile = new File( outputDirectoryString 
);
+                    if ( outputDirectoryFile.exists() )
+                    {
+                        URL outputDirectoryUrl = 
outputDirectoryFile.toURI().toURL();
+                        getLogger().debug( "Adding the outputDirectory " + 
outputDirectoryUrl.toString()
+                                               + " to the Checkstyle class 
path" );
+                        urls.add( outputDirectoryUrl );
+                    }
+                }
+            }
+            catch ( MalformedURLException e )
+            {
+                throw new CheckstyleExecutorException( e.getMessage(), e );
+            }
+        }
+
+        URLClassLoader projectClassLoader = AccessController.doPrivileged( new 
PrivilegedAction<URLClassLoader>()
+        {
+            public URLClassLoader run()
 
 Review comment:
   `@Override`
   
   also, this would be clearer as a non-anonymous class or even an outer class

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to