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

StringIndexOutOfBoundsException: String index out of range: -592 #258

Closed
sofiageo opened this issue Jul 8, 2016 · 3 comments
Closed

StringIndexOutOfBoundsException: String index out of range: -592 #258

sofiageo opened this issue Jul 8, 2016 · 3 comments

Comments

@sofiageo
Copy link

sofiageo commented Jul 8, 2016

I'm not sure what this is about. It happens when I change the following line in my class
Before: LOGGER.warn(e.getMessage());
After: LOGGER.warn("FME error" + e.getMessage());

But reading the stacktrace it looks like it is something about the single line comments.

CheckStyle threw an exception when scanning: xxx.java: Exception was thrown while processing /tmp/csi-6ce0c912-bd97-49ee-99cb-52c0e063a983/src/xxx
org.infernus.idea.checkstyle.exception.CheckStylePluginException: Exception was thrown while processing /tmp/csi-6ce0c912-bd97-49ee-99cb-52c0e063a983/xxx
    at org.infernus.idea.checkstyle.exception.CheckStylePluginException.wrap(CheckStylePluginException.java:45)
    at org.infernus.idea.checkstyle.exception.CheckStylePluginException.wrap(CheckStylePluginException.java:34)
    at org.infernus.idea.checkstyle.checker.CheckStyleChecker.processAndAudit(CheckStyleChecker.java:70)
    at org.infernus.idea.checkstyle.checker.CheckStyleChecker.scan(CheckStyleChecker.java:44)
    at org.infernus.idea.checkstyle.CheckStyleInspection.lambda$inspectFile$1(CheckStyleInspection.java:86)
    at java.util.Optional.map(Optional.java:215)
    at org.infernus.idea.checkstyle.CheckStyleInspection.inspectFile(CheckStyleInspection.java:86)
    at org.infernus.idea.checkstyle.CheckStyleInspection.lambda$checkFile$0(CheckStyleInspection.java:58)
    at com.intellij.openapi.application.impl.ApplicationImpl$9.call(ApplicationImpl.java:394)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing /tmp/csi-6ce0c912-bd97-49ee-99cb-52c0e063a983/xxx
    at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:281)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:196)
    at org.infernus.idea.checkstyle.checker.CheckStyleChecker.processAndAudit(CheckStyleChecker.java:68)
    ... 10 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -592
    at java.lang.String.substring(String.java:1931)
    at com.puppycrawl.tools.checkstyle.api.FileContents.reportCppComment(FileContents.java:112)
    at com.puppycrawl.tools.checkstyle.api.FileContents.reportSingleLineComment(FileContents.java:96)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaLexer.mSINGLE_LINE_COMMENT(GeneratedJavaLexer.java:1116)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaLexer.nextToken(GeneratedJavaLexer.java:331)
    at antlr.TokenStreamHiddenTokenFilter.consume(TokenStreamHiddenTokenFilter.java:38)
    at antlr.TokenStreamHiddenTokenFilter.nextToken(TokenStreamHiddenTokenFilter.java:134)
    at antlr.TokenBuffer.fill(TokenBuffer.java:69)
    at antlr.TokenBuffer.LA(TokenBuffer.java:80)
    at antlr.LLkParser.LA(LLkParser.java:52)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.postfixExpression(GeneratedJavaRecognizer.java:7571)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.unaryExpressionNotPlusMinus(GeneratedJavaRecognizer.java:7254)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.unaryExpression(GeneratedJavaRecognizer.java:7069)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.multiplicativeExpression(GeneratedJavaRecognizer.java:6934)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.additiveExpression(GeneratedJavaRecognizer.java:6885)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.shiftExpression(GeneratedJavaRecognizer.java:6828)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.relationalExpression(GeneratedJavaRecognizer.java:6745)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.equalityExpression(GeneratedJavaRecognizer.java:6696)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.andExpression(GeneratedJavaRecognizer.java:6667)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.exclusiveOrExpression(GeneratedJavaRecognizer.java:6638)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.inclusiveOrExpression(GeneratedJavaRecognizer.java:6609)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.logicalAndExpression(GeneratedJavaRecognizer.java:6580)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.logicalOrExpression(GeneratedJavaRecognizer.java:6551)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.conditionalExpression(GeneratedJavaRecognizer.java:2135)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.assignmentExpression(GeneratedJavaRecognizer.java:6303)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.expression(GeneratedJavaRecognizer.java:4764)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.expressionList(GeneratedJavaRecognizer.java:6063)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.argList(GeneratedJavaRecognizer.java:3435)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.postfixExpression(GeneratedJavaRecognizer.java:7539)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.unaryExpressionNotPlusMinus(GeneratedJavaRecognizer.java:7254)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.unaryExpression(GeneratedJavaRecognizer.java:7069)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.multiplicativeExpression(GeneratedJavaRecognizer.java:6934)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.additiveExpression(GeneratedJavaRecognizer.java:6885)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.shiftExpression(GeneratedJavaRecognizer.java:6828)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.relationalExpression(GeneratedJavaRecognizer.java:6745)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.equalityExpression(GeneratedJavaRecognizer.java:6696)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.andExpression(GeneratedJavaRecognizer.java:6667)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.exclusiveOrExpression(GeneratedJavaRecognizer.java:6638)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.inclusiveOrExpression(GeneratedJavaRecognizer.java:6609)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.logicalAndExpression(GeneratedJavaRecognizer.java:6580)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.logicalOrExpression(GeneratedJavaRecognizer.java:6551)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.conditionalExpression(GeneratedJavaRecognizer.java:2135)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.assignmentExpression(GeneratedJavaRecognizer.java:6303)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.expression(GeneratedJavaRecognizer.java:4764)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.traditionalStatement(GeneratedJavaRecognizer.java:5342)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.statement(GeneratedJavaRecognizer.java:4251)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compoundStatement(GeneratedJavaRecognizer.java:3917)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.handler(GeneratedJavaRecognizer.java:6163)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.tryBlock(GeneratedJavaRecognizer.java:5621)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.traditionalStatement(GeneratedJavaRecognizer.java:5274)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.statement(GeneratedJavaRecognizer.java:4251)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compoundStatement(GeneratedJavaRecognizer.java:3917)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.traditionalStatement(GeneratedJavaRecognizer.java:5008)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.statement(GeneratedJavaRecognizer.java:4251)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.traditionalStatement(GeneratedJavaRecognizer.java:5069)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.statement(GeneratedJavaRecognizer.java:4251)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compoundStatement(GeneratedJavaRecognizer.java:3917)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.field(GeneratedJavaRecognizer.java:3319)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.classBlock(GeneratedJavaRecognizer.java:2541)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.classDefinition(GeneratedJavaRecognizer.java:634)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.typeDefinitionInternal(GeneratedJavaRecognizer.java:556)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.typeDefinition(GeneratedJavaRecognizer.java:389)
    at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit(GeneratedJavaRecognizer.java:202)
    at com.puppycrawl.tools.checkstyle.TreeWalker.parse(TreeWalker.java:440)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:175)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:78)
    at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:301)
    at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:271)
    ... 12 more

@jshiell
Copy link
Owner

jshiell commented Jul 8, 2016

Thanks for the report!

Checkstyle isn't designed to work on files being modified, so there's a certain amount of black magic around making it do it. As such, it's probably a temporary parse error that isn't being caught. I'll try and have a look this weekend.

@jshiell
Copy link
Owner

jshiell commented Jul 8, 2016

StringIndexOutOfBoundsException was indeed missing from the list of parse exceptions - this should be handled as of 4.30.1, which should be released later this weekend. Thanks for the feedback!

@jshiell jshiell closed this as completed Jul 8, 2016
@sofiageo
Copy link
Author

sofiageo commented Jul 8, 2016

No problem, happy to help :) Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants