CLI should print a flie name where exception is happen #2109

Closed
romani opened this Issue Sep 4, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@romani
Member

romani commented Sep 4, 2015

java -jar checkstyle-6.10.1-all.jar -c sun_checks.xml *.java

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.AbstractStringBuilder.charAt(Unknown Source)
        at java.lang.StringBuilder.charAt(Unknown Source)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.trimTail(JavadocStyleCheck.java:315)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.getCommentText(JavadocStyleCheck.java:269)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.checkFirstSentenceEnding(JavadocStyleCheck.java:230)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.checkComment(JavadocStyleCheck.java:207)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.visitToken(JavadocStyleCheck.java:148)
        at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:392)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:503)
        at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:334)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:209)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:79)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:265)
        at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:271)
        at com.puppycrawl.tools.checkstyle.Main.main(Main.java:121)

So where is no easy way to find a reason (input file) of problem. File path should be printed.

@romani romani added the approved label Sep 4, 2015

@romani romani added the high demand label Oct 13, 2015

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Oct 13, 2015

Member

Getting details failure is almost impossible now, we need to address this ASAP.

See #2327 , #2326 .

Member

romani commented Oct 13, 2015

Getting details failure is almost impossible now, we need to address this ASAP.

See #2327 , #2326 .

@Vampire

This comment has been minimized.

Show comment
Hide comment
@Vampire

Vampire Oct 13, 2015

Contributor

I don't think this is related to #2326, there the real error is not shown at all, but the previously found one :-)

Contributor

Vampire commented Oct 13, 2015

I don't think this is related to #2326, there the real error is not shown at all, but the previously found one :-)

romani added a commit that referenced this issue Oct 30, 2015

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Oct 30, 2015

Member

@mkordas , do you have better approach to fix this ? (see my non merged commit and PR)

Member

romani commented Oct 30, 2015

@mkordas , do you have better approach to fix this ? (see my non merged commit and PR)

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Oct 30, 2015

Member

We need to catch and rethrow with context information (file path) in Exception as we do not know how our code is used (plugin, embedded, ....), we can not reply on logger, as it could be switched off.

Member

romani commented Oct 30, 2015

We need to catch and rethrow with context information (file path) in Exception as we do not know how our code is used (plugin, embedded, ....), we can not reply on logger, as it could be switched off.

romani added a commit that referenced this issue Oct 30, 2015

romani added a commit that referenced this issue Oct 31, 2015

romani added a commit that referenced this issue Oct 31, 2015

romani added a commit that referenced this issue Oct 31, 2015

romani added a commit that referenced this issue Oct 31, 2015

@mkordas

This comment has been minimized.

Show comment
Hide comment
@mkordas

mkordas Oct 31, 2015

Contributor

@romani, I like the approach.

Contributor

mkordas commented Oct 31, 2015

@romani, I like the approach.

romani added a commit that referenced this issue Nov 1, 2015

romani added a commit that referenced this issue Nov 1, 2015

romani added a commit that referenced this issue Nov 1, 2015

romani added a commit that referenced this issue Nov 1, 2015

@romani romani added this to the 6.12 milestone Nov 1, 2015

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Nov 1, 2015

Member

merged.

See discussions at #2476 , #2487 .

Member

romani commented Nov 1, 2015

merged.

See discussions at #2476 , #2487 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment