Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

romani opened this issue Sep 4, 2015 · 6 comments
Milestone

Comments

@romani
Copy link
Member

@romani 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
Copy link
Member Author

@romani romani commented Oct 13, 2015

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

See #2327 , #2326 .

@Vampire
Copy link
Contributor

@Vampire 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
Copy link
Member Author

@romani romani commented Oct 30, 2015

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

@romani
Copy link
Member Author

@romani 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
Copy link
Contributor

@mkordas 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
Copy link
Member Author

@romani 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.