您的位置:首页 > 编程语言 > Java开发

Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'XXXException'.

2009-08-20 16:28 966 查看
This message can be quite confusing. The cause of this message cannot be easily guessed from the error message CheckStyle gives.

The
cause is that the class ConfigurationException, which is mentioned in
BasicPDFBuilder is not in the run classpath of Checkstyle, so
checkstyle cannot perform any checks on whether it is a checked
exception or a runtime exception or other. So this is not really a
warning about your code being bad, but a warning about checkstyle being
unable to fully check whether the import and usage of the class
ConfigurationException conforms to the coding styles configured.

So
you need to modify the ant scriptlet which runs your checkstyle (-when
running checkstyle locally, during automatic screening there's nothing
you can do about it..) to include all libraries in the run classpath:

<taskdef resource="checkstyletask.properties"
/>

<target name="checkstyle"
depends="compile"
>

<mkdir dir="${testlogdir}"
/>

<checkstyle failonviolation="false"
config="../tc_checks.xml"
>

<classpath>

<path refid="buildlibs"
/>

<pathelement location="${build_classdir}"
/>

</classpath>

<fileset dir="${javamain}"
includes="**/*.java"
/>

<formatter type="plain"
toFile="${testlogdir}/checkstyle.txt"
/>

</checkstyle>

</target>

<target name="checkstyle_tests"
depends="compile_tests"
>

<mkdir dir="${testlogdir}"
/>

<checkstyle failonviolation="false"
config="../tc_test_checks.xml"
>

<classpath>

<path refid="buildlibs"
/>

<pathelement location="${javatests}"
/>

</classpath>

<fileset dir="${javatests}/${packagedir}/"
includes="**/*.java"

excludes="UnitTests.java, AllTests.java, stresstests/*, failuretests/*, accuracytests/*"
/>

<formatter type="plain"
toFile="${testlogdir}/checkstyletest.txt"
/>

</checkstyle>

</target>


Note: the files tc_checks.xml and tc_test_checks.xml can be obtained here: http://www.topcoder.com/tc?module=Static&d1=dev&d2=support&d3=compDocumentation

For
this message to not occur during automatic screening some admin needs
to fix this thing on the TC server, but as this classpath is
component-dependant (each component uses different libraries) and I
assume that the checks performed during automatic screening use one
generic script for all submissons of all components, this would be a
bigger change on the TC automatic screening implementation (even more
complicated: if the submitter added some 3rd-party libraries, that were
not part of CS in its submission).

So in general add the code mentioned above in your local build.xml (ivern
,
perhaps you could add this to the dev dist jars as a convenience...)
and add checkstyle to your ant classpath, then check locally and fix
the things you want. Afterwards you dont't need to look at the
checkstyle results during automatic screening(as they should be
identical to the local check results ) and instead only need to check
the results of the other automatic-screening-modules (like your name
found in your submission).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐