Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#419 Occasional comma after exception class name stops checkstyle

release_4.0
closed
Oliver Burn
5
2012-10-10
2006-03-15
Dmitri Girenko
No

Found this with eclipse checkstyle plugin, but the
problem may be in the original checkstyle code.

Whenever there's a comma after the exception class
name in the @throws clause, checkstyle throws a
runtime exception and stops parsing that file. Here
is the exception stacktrace:

!ENTRY com.atlassw.tools.eclipse.checkstyle 1 0 2006-
03-15 15:32:24.632
!MESSAGE Checkstyle-Plugin: Throwable occured.
!STACK 0
java.lang.RuntimeException: Unable to get class
information for @throws tag 'FerretMessageException,'.
at
com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwa
reCheck.logLoadErrorImpl
(AbstractTypeAwareCheck.java:248)
at
com.puppycrawl.tools.checkstyle.checks.javadoc.Javadoc
MethodCheck.logLoadError(JavadocMethodCheck.java:305)
at
com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwa
reCheck.tryLoadClass(AbstractTypeAwareCheck.java:219)
at
com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwa
reCheck$RegularClass.getClazz
(AbstractTypeAwareCheck.java:43>
at
com.puppycrawl.tools.checkstyle.checks.javadoc.Javadoc
MethodCheck.checkThrowsTags
(JavadocMethodCheck.java:703)
at
com.puppycrawl.tools.checkstyle.checks.javadoc.Javadoc
MethodCheck.checkComment(JavadocMethodCheck.java:357)
at
com.puppycrawl.tools.checkstyle.checks.javadoc.Javadoc
MethodCheck.processAST(JavadocMethodCheck.java:293)
at
com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwa
reCheck.visitToken(AbstractTypeAwareCheck.java:105)
at
com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit
(TreeWalker.java:493)
at
com.puppycrawl.tools.checkstyle.TreeWalker.processIter
(TreeWalker.java:618)
at com.puppycrawl.tools.checkstyle.TreeWalker.walk
(TreeWalker.java:419)
at
com.puppycrawl.tools.checkstyle.TreeWalker.process
(TreeWalker.java:244)
at
com.puppycrawl.tools.checkstyle.TreeWalker.process
(TreeWalker.java:583)
at com.puppycrawl.tools.checkstyle.Checker.process
(Checker.java:239)
at
com.atlassw.tools.eclipse.checkstyle.builder.Auditor.r
unAudit(Auditor.java:192)
at
com.atlassw.tools.eclipse.checkstyle.builder.Checkstyl
eBuilder.handleBuildSelection
(CheckstyleBuilder.java:308)
at
com.atlassw.tools.eclipse.checkstyle.builder.Checkstyl
eBuilder.build(CheckstyleBuilder.java:203)
at
org.eclipse.core.internal.events.BuildManager$2.run
(BuildManager.java:593)
at
org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run
(Platform.java:783)
at
org.eclipse.core.internal.events.BuildManager.basicBui
ld(BuildManager.java:168)
at
org.eclipse.core.internal.events.BuildManager.basicBui
ld(BuildManager.java:202)
at
org.eclipse.core.internal.events.BuildManager$1.run
(BuildManager.java:231)
at
org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run
(Platform.java:783)
at
org.eclipse.core.internal.events.BuildManager.basicBui
ld(BuildManager.java:234)
at
org.eclipse.core.internal.events.BuildManager.basicBui
ldLoop(BuildManager.java:253)
at
org.eclipse.core.internal.events.BuildManager.build
(BuildManager.java:282)
at
org.eclipse.core.internal.events.AutoBuildJob.doBuild
(AutoBuildJob.java:139)
at org.eclipse.core.internal.events.AutoBuildJob.run
(AutoBuildJob.java:200)
at org.eclipse.core.internal.jobs.Worker.run
(Worker.java:76)

and here is the piece of code that causes it:

import java.util.Date;

public interfacce DateParser {
/
* Gets the message timestamp.


* @return the message timestamp.
* @throws Exception, if date parsing fails.

/
public Date getDate() throws Exception;
}

Discussion

  • Oliver Burn
    Oliver Burn
    2006-03-15

    Logged In: YES
    user_id=218824

    hmmm -- that is not good

     
  • Dmitri Girenko
    Dmitri Girenko
    2006-03-16

    Logged In: YES
    user_id=1476827

    AFter some more investigation it looks like this
    particular runtime exception occurs only when running
    under eclipse checkstyle plugin. When started as a
    standalone application, checkstyle correctly reports the
    invalid @throws clause.

    Later I found that the checkstyle plugin uses Checkstyle
    Implementation-Version: 4.2. The version that we use in
    our repository pre-commit verification (the one that
    correctly reports the problem) is 4.0-beta6. Maybe this
    gives some clues.

    Unfortunately I do not have an opportunity to try 4.2
    version in the same environment.

    BR
    Dmitri

     
  • Logged In: YES
    user_id=1238882

    Just to clarify things a bit:
    the eclipse-cs plugin versions 4.1.0 beta and beta2 contain
    a patched version of Checkstyle 4.1 (the
    ConfigurationLoader issue).

    Personally I believe this to be the same problem as in
    https://sourceforge.net/tracker/?
    func=detail&atid=397078&aid=1422462&group_id=29721 - just
    the usual RuntimeException when a class could not be loaded
    by a type aware check. Of course a class with
    name "Exception," does not exists, resulting in the RTE
    being thrown and Checkstyle stopping to check this file.

    A change was made recently (see the issue referenced above)
    to Checkstyle to add a new configuration property to all
    type aware checks. When this property is set Checkstyle
    will continue on the file even when it does not find a
    class it looks for.

    Regards,
    Lars Ködderitzsch

     
  • Dmitri Girenko
    Dmitri Girenko
    2006-03-16

    Logged In: YES
    user_id=1476827

    You're right, this is the same issue. It's a pity that I
    did not find that ticket before. I think that reporting
    the load error is more than enough to detect the problem.

    Thanks for your help!