maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niraj Tolia (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (MCHECKSTYLE-111) More information on issue: "Got an exception - java.lang.RuntimeException: Unable to get class information for [exception]"
Date Wed, 03 Aug 2011 02:33:42 GMT

    [ https://jira.codehaus.org/browse/MCHECKSTYLE-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=274861#comment-274861
] 

Niraj Tolia commented on MCHECKSTYLE-111:
-----------------------------------------

We ran into this at work too. Evidently checkstyle, if run on uncompiled code, will not be
able to find your custom exceptions. With compiled code (what we usually do), it looks like
things should be OK unless your error originates from a dependency that is marked with a test
scope. In our project, junit currently is marked as being in the test scope but that is where
the InitializationError Exception comes from and what triggered the bug for us. It should
be possible to fix this by pointing checkstyle to the right dependency but I am not completely
sure how.

> More information on issue: "Got an exception - java.lang.RuntimeException: Unable to
get class information for [exception]"
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-111
>                 URL: https://jira.codehaus.org/browse/MCHECKSTYLE-111
>             Project: Maven 2.x Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: Windows Vista Business (x64), Windows XP (x86), Windows 2003 Server
(x86)
> Apache Maven 2.1.0 (r755702; 2009-03-18 20:10:27+0100) and Maven 2.0.10
> Java version: 1.6.0_13
>            Reporter: Michael Grossniklaus
>            Priority: Blocker
>         Attachments: maven-checkstyle-plugin.zip, output.txt
>
>
> This bug report provides more insight on the situations in which the maven-checkstyle-plugin
is unable to get the class information for exceptions that are declared by the project. This
report is, therefore, a refinement of prior bug reports such as MPCHECKSTYLE-1, MPCHECKSTYLE-20,
or MCHECKSTYLE-54. We believe, however, that through a more in-depth study of the problem
we can provide a narrower definition of the problem that, hopefully, will result in it resolution.
> Our experiments have shown that the maven-checkstyle-plugin fails for classes or interfaces
that contain method signatures with a "throws" clause pointing to exception defined by both
the project and elsewhere. This is demonstrated by the interface "ch.ethz.globis.demo.Demo"
contained in the attached demo project.
> {{
> public interface Demo {
>    void foo() throws DemoException, IOException, FileNotFoundException;
>    void foofoo() throws DemoException;
>    void bar() throws IOException, FileNotFoundException, IllegalArgumentException;
> }
> }}
> If the command "mvn checkstyle:check" is executed in the project, it will fail with one
checkstyle violation. If, however, the method "foo()" is commented (or removed), everything
works fine. Note that method "foofoo()" which *only* declares "ch.ethz.globis.demo.DemoException"
is unproblematic as well as method "bar()" which declares a set of exceptions that are declared
outside the project. Hence, the conclusion is that it is the combination of *both* project
and outside-project exceptions that make the maven-checkstyle-plugin fail. Note that we have
run maven on clean installation (where the local repository has been removed first) to produce
a reproducible error.
> The attached zip file contains both the demo project that can be used to reproduce the
error as well as the output of the "mvn checkstyle:check" command under "target". We also
provide the file "output.txt" that documents the console output of the command. If further
documentation is required, do not hesitate to contact me. We hope that by providing this information
we can contribute to the resolution of said issue, once and for all.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message