You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "zhongbing (JIRA)" <ji...@codehaus.org> on 2007/12/04 03:03:57 UTC

[jira] Commented: (MPCHECKSTYLE-20) Unable to get class information for custom exceptions

    [ http://jira.codehaus.org/browse/MPCHECKSTYLE-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_115751 ] 

zhongbing commented on MPCHECKSTYLE-20:
---------------------------------------

I have got this problem. I used the ant to call checkstyle, then I got the problem:Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'ServletException'.

The cause is that checkstyle can't find out the exception class in classpath. So It only needs to add the jar of the exception class to the classpath. For example:

<checkstyle config="${tools.checkstyle.ruleset}" failOnViolation="false" failureProperty="checkstyle.failure">
<classpath>
	<path refid="classpath.project.lib" />
	<path refid="classpath.tools.libs" />
	<path refid="classpath.catalina" />
</classpath>
<formatter type="xml" tofile="${report.checkstyleReport.xml}" />
<fileset dir="${project.src}" includes="**/*.java" />
</checkstyle>

I add the <path> in classpath, it will run successfully.

> Unable to get class information for custom exceptions
> -----------------------------------------------------
>
>                 Key: MPCHECKSTYLE-20
>                 URL: http://jira.codehaus.org/browse/MPCHECKSTYLE-20
>             Project: Maven 1.x Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: maven-1.0-rc2
>            Reporter: Ryan Sonnek
>
> checkstyle reports an error "Unable to get class information" for custom exceptions within the same project.  it is able to load exceptions that are listed as dependencies for the project, but not for other exceptions.  one workaround is to only use throws Exception in the signiture, but that's really a hack.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira