Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PMD violation UseProperClassLoader #5680

Closed
pbludov opened this issue Apr 3, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@pbludov
Copy link
Collaborator

commented Apr 3, 2018

PMD 6.0 complains about the method getClassLoader(). It should be replaced with Thread.currentThread().getContextClassLoader()

The rule

@romani

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

Ok, it is j2ee specific, we are not affected but might help smb who try embeding checkstyle to j2ee project.

@rnveach

This comment has been minimized.

Copy link
Member

commented Mar 9, 2019

Enabling this produces the following errors:

[INFO] --- maven-pmd-plugin:3.11.0:check (default) @ checkstyle ---
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.Main:363 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.XmlLoader:95 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask:397 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.CheckerTest:351 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsPagesTest:303 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.utils.TestUtil:164 Rule:UseProperClassLoader Priority:3 In J2EE, getClassLoader() might not work as expected.  Use Thread.currentThread().getContextClassLoader() instead..
@rnveach

This comment has been minimized.

Copy link
Member

commented Mar 9, 2019

I can no longer execute checkstyle in maven with this change:

[INFO] --- maven-antrun-plugin:1.8:run (ant-phase-verify) @ checkstyle ---
[INFO] Executing tasks

main:

execute:
     [echo] Checkstyle started (checkstyle_checks.xml): 09/03/2019 04:19:40 PM
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.693 s (Wall Clock)
[INFO] Finished at: 2019-03-09T16:19:41-05:00
[INFO] Final Memory: 37M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (ant-phase-verify) on project checkstyle: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] M:\checkstyleWorkspace\checkstyle\config\ant-phase-verify.xml:31: Unable to create Root Module: config {M:\checkstyleWorkspace\checkstyle\config\checkstyle_checks.xml}, classpath {M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar}.
[ERROR] around Ant part ...<ant antfile="config/ant-phase-verify.xml"/>... @ 8:47 in M:\checkstyleWorkspace\checkstyle\target\antrun\build-main.xml: unable to parse configuration stream: MalformedURLException: NullPointerException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (ant-phase-verify) on project checkstyle: An Ant BuildException has occured: The following error occurred while executing this line:
M:\checkstyleWorkspace\checkstyle\config\ant-phase-verify.xml:31: Unable to create Root Module: config {M:\checkstyleWorkspace\checkstyle\config\checkstyle_checks.xml}, classpath {M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar}.
around Ant part ...<ant antfile="config/ant-phase-verify.xml"/>... @ 8:47 in M:\checkstyleWorkspace\checkstyle\target\antrun\build-main.xml
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:181)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
M:\checkstyleWorkspace\checkstyle\config\ant-phase-verify.xml:31: Unable to create Root Module: config {M:\checkstyleWorkspace\checkstyle\config\checkstyle_checks.xml}, classpath {M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar}.
around Ant part ...<ant antfile="config/ant-phase-verify.xml"/>... @ 8:47 in M:\checkstyleWorkspace\checkstyle\target\antrun\build-main.xml
	at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:342)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 11 more
Caused by: M:\checkstyleWorkspace\checkstyle\target\antrun\build-main.xml:8: The following error occurred while executing this line:
M:\checkstyleWorkspace\checkstyle\config\ant-phase-verify.xml:31: Unable to create Root Module: config {M:\checkstyleWorkspace\checkstyle\config\checkstyle_checks.xml}, classpath {M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar}.
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:568)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:443)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:313)
	... 13 more
Caused by: M:\checkstyleWorkspace\checkstyle\config\ant-phase-verify.xml:31: Unable to create Root Module: config {M:\checkstyleWorkspace\checkstyle\config\checkstyle_checks.xml}, classpath {M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar}.
	at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:415)
	at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.realExecute(CheckstyleAntTask.java:305)
	at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.execute(CheckstyleAntTask.java:288)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
	... 25 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to parse configuration stream
	at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:453)
	at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:395)
	at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:393)
	... 40 more
Caused by: java.net.MalformedURLException
	at java.net.URL.<init>(URL.java:627)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:620)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
	at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:84)
	at com.puppycrawl.tools.checkstyle.ConfigurationLoader.parseInputSource(ConfigurationLoader.java:197)
	at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:443)
	... 42 more
Caused by: java.lang.NullPointerException
	at java.net.URL.<init>(URL.java:532)
	... 61 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

XmlLoader's getResourceAsStream now returns null when requesting the DTD.

@rnveach

This comment has been minimized.

Copy link
Member

commented Mar 9, 2019

The class loaders seem completely different and they share no common parents. I don't know the specifics but it doesn't look like this change is possible.

Original
Parent 0: AntClassLoader[M:\checkstyleWorkspace\checkstyle\target\classes;C:\Users\Ricky\.m2\repository\info\picocli\picocli\3.9.5\picocli-3.9.5.jar;C:\Users\Ricky\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Ricky\.m2\repository\org\antlr\antlr4-runtime\4.7.2\antlr4-runtime-4.7.2.jar;C:\Users\Ricky\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\Ricky\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Ricky\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\Ricky\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\Ricky\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Ricky\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Ricky\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Ricky\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\Ricky\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\Ricky\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\Ricky\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\Ricky\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-1\Saxon-HE-9.9.1-1.jar]
Parent 1: sun.misc.Launcher$AppClassLoader@647e05
Parent 2: sun.misc.Launcher$ExtClassLoader@176015f
New
Parent 0: ClassRealm[plugin>org.apache.maven.plugins:maven-antrun-plugin:1.8, parent: sun.misc.Launcher$AppClassLoader@647e05]

I assume we are getting maven's class loader instead of ant's ?

I tried adding / to the resource path but it didn't help any.

I have no problems loading the resource outside ant/maven with either way. Both class loaders are exactly the same.

It must be ant.
Maybe it's related to https://bz.apache.org/bugzilla/show_bug.cgi?id=36717 ?

Could be why CheckstyleAnt creates it's own classloader?
https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java#L406-L409

@rnveach

This comment has been minimized.

Copy link
Member

commented Mar 9, 2019

@pbludov @romani Unless either of you know anything about this and can fix it, I think we should just not enable this.

@romani

This comment has been minimized.

Copy link
Member

commented Mar 17, 2019

I think we should just update suppression comment at https://github.com/checkstyle/checkstyle/blob/master/config/pmd.xml#L168 to be "reason of suppression is at issue" and keep it disabled.

@pbludov, what do you think ?

@pbludov

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 17, 2019

I think we should just update suppression comment and keep it disabled.

done.

romani added a commit that referenced this issue Mar 18, 2019

@romani romani added this to the 8.19 milestone Mar 18, 2019

@romani

This comment has been minimized.

Copy link
Member

commented Mar 18, 2019

Fix us merged

@romani romani closed this Mar 18, 2019

Vantuz added a commit to Vantuz/checkstyle that referenced this issue Apr 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.