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

来源:互联网 发布:手机淘宝5.6.0.版本 编辑:程序博客网 时间:2024/05/28 16:14

This message can be quite confusing. The cause of this message cannot be easily guessed from the error message CheckStyle gives.

Thecause is that the class ConfigurationException, which is mentioned inBasicPDFBuilder is not in the run classpath of Checkstyle, socheckstyle cannot perform any checks on whether it is a checkedexception or a runtime exception or other. So this is not really awarning about your code being bad, but a warning about checkstyle beingunable to fully check whether the import and usage of the classConfigurationException conforms to the coding styles configured.

Soyou need to modify the ant scriptlet which runs your checkstyle (-whenrunning checkstyle locally, during automatic screening there's nothingyou 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

Forthis message to not occur during automatic screening some admin needsto fix this thing on the TC server, but as this classpath iscomponent-dependant (each component uses different libraries) and Iassume that the checks performed during automatic screening use onegeneric script for all submissons of all components, this would be abigger change on the TC automatic screening implementation (even morecomplicated: if the submitter added some 3rd-party libraries, that werenot 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 fixthe things you want. Afterwards you dont't need to look at thecheckstyle results during automatic screening(as they should beidentical to the local check results ) and instead only need to checkthe results of the other automatic-screening-modules (like your namefound in your submission).

原创粉丝点击