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

ArrayIndexOutOfBoundsException in ImportCohesionCheck on file with imports only #451

Closed
mkordas opened this issue Aug 1, 2015 · 33 comments
Labels

Comments

@mkordas
Copy link
Contributor

mkordas commented Aug 1, 2015

I get the following exception while doing analysis of Checkstyle project:

[ERROR] Failed to execute goal com.qulice:qulice-maven-plugin:0.12.1:check (default-cli) on project checkstyle: Execution default-cli of goal com.qulice:qulice-maven-plugin:0.12.1:check failed: 8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.qulice:qulice-maven-plugin:0.12.1:check (default-cli) on project checkstyle: Execution default-cli of goal com.qulice:qulice-maven-plugin:0.12.1:check failed: 8
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.qulice:qulice-maven-plugin:0.12.1:check failed: 8
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 8
    at com.puppycrawl.tools.checkstyle.api.FileText.get(FileText.java:346)
    at com.puppycrawl.tools.checkstyle.api.FileText.get(FileText.java:54)
    at com.qulice.checkstyle.ImportCohesionCheck.check(ImportCohesionCheck.java:95)
    at com.qulice.checkstyle.ImportCohesionCheck.processFiltered(ImportCohesionCheck.java:75)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:73)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:263)
    at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:92)
    at com.qulice.maven.CheckMojo.run(CheckMojo.java:83)
    at com.qulice.maven.CheckMojo.doExecute(CheckMojo.java:59)
    at com.qulice.maven.AbstractQuliceMojo.execute(AbstractQuliceMojo.java:175)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more

Do you need anything else to reproduce?

@davvd
Copy link

davvd commented Aug 5, 2015

@yegor256 please do something about this issue

@yegor256
Copy link
Owner

yegor256 commented Aug 5, 2015

@mkordas would be great to see your .java file where it crashes.

@davvd davvd mentioned this issue Nov 2, 2015
@krzyk
Copy link
Collaborator

krzyk commented Nov 2, 2015

@mkordas Could you add an example java file that causes this crash?

@mkordas
Copy link
Contributor Author

mkordas commented Nov 2, 2015

@krzyk I don't know the file. Any hints how can I track it? I tried updating to Checkstyle 6.12 which reports problematic filename in stacktraces, but I didn't succeed with building qulice-maven-plugin locally: java.lang.ClassNotFoundException: com.qulice.spi.Environment or java.lang.NullPointerException at org.codehaus.plexus.component.configurator.converters.composite.CollectionConverter.fromChildren(CollectionConverter.java:157

@krzyk
Copy link
Collaborator

krzyk commented Nov 3, 2015

@mkordas Maybe we could change this issue into a an upgrade to checkstyle 6.12? We could do a release and then you could check if qulice fails on your code, and if it does you would have the filename?

@krzyk
Copy link
Collaborator

krzyk commented Nov 3, 2015

@mkordas BTW is there an info about filenames in stack traces in Checkstyle realise notes? I can't find it.

@mkordas
Copy link
Contributor Author

mkordas commented Nov 3, 2015

@krzyk
I think we can just create another issue to upgrade Checkstyle: #487

There is note about additional logging in release notes:

@krzyk
Copy link
Collaborator

krzyk commented Nov 3, 2015

@mkordas But until the checkstyle is upgraded this issue is not valid, without an example we don't know where is the problem.

@mkordas
Copy link
Contributor Author

mkordas commented Nov 3, 2015

@krzyk OK, so I'm closing it.

@mkordas mkordas closed this as completed Nov 3, 2015
@mkordas
Copy link
Contributor Author

mkordas commented Nov 3, 2015

@krzyk I've managed to build Qulice with Checkstyle 6.12 locally (although I needed to do mvn install -Dmaven.test.skip=true install -Dinvoker.skip=true because tests were failing in my Windows environment) and here's nice end of stacktrace:

Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing src\test\resources\Reproducer.java
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:282)
    at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:89)
    ... 31 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
    at com.puppycrawl.tools.checkstyle.api.FileText.get(FileText.java:324)
    at com.puppycrawl.tools.checkstyle.api.FileText.get(FileText.java:58)
    at com.qulice.checkstyle.ImportCohesionCheck.check(ImportCohesionCheck.java:95)
    at com.qulice.checkstyle.ImportCohesionCheck.processFiltered(ImportCohesionCheck.java:75)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:79)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:266)
    ... 32 more

Minimal reproducer:

package com.google;

import java.util.*;

Note: this is valid and compilable Java file.

@mkordas mkordas reopened this Nov 3, 2015
@krzyk
Copy link
Collaborator

krzyk commented Nov 4, 2015

@mkordas interesting case, thanks

@krzyk
Copy link
Collaborator

krzyk commented Nov 4, 2015

@mkordas could you add a he code above to the issue description? It will be easier to find.

@krzyk
Copy link
Collaborator

krzyk commented Nov 4, 2015

@davvd valid bug

@davvd
Copy link

davvd commented Nov 4, 2015

@davvd valid bug

@krzyk I added bug tag to this ticket

@mkordas mkordas changed the title ArrayIndexOutOfBoundsException in ImportCohesionCheck ArrayIndexOutOfBoundsException in ImportCohesionCheck on file with imports only Nov 7, 2015
@mkordas
Copy link
Contributor Author

mkordas commented Nov 7, 2015

@mkordas could you add a he code above to the issue description? It will be easier to find.

@krzyk, is it fine now?

@krzyk
Copy link
Collaborator

krzyk commented Nov 8, 2015

@mkordas yes, thanks

@krzyk
Copy link
Collaborator

krzyk commented Nov 26, 2015

@davvd this is postponed

@davvd
Copy link

davvd commented Nov 26, 2015

@davvd this is postponed

@krzyk OK, I put "postponed" label here

@davvd
Copy link

davvd commented Nov 26, 2015

@davvd this is postponed

@krzyk no problem, I will try to find somebody else

@davvd
Copy link

davvd commented Dec 9, 2015

@mkordas thanks for this report, I added 15 mins to your account, in transaction 566830ec6d5fb6522c0000c9

@yegor256 yegor256 mentioned this issue Jan 14, 2016
@krzyk
Copy link
Collaborator

krzyk commented Jan 17, 2016

@davvd this is not postponed

@krzyk
Copy link
Collaborator

krzyk commented Jan 17, 2016

@HDouss want to take this?

@HDouss
Copy link
Contributor

HDouss commented Jan 17, 2016

@krzyk Yes please.

@krzyk
Copy link
Collaborator

krzyk commented Jan 17, 2016

@davvd assign @HDouss please

@davvd
Copy link

davvd commented Jan 18, 2016

@davvd this is not postponed

@krzyk sure, thanks, I removed "postponed" tag to it

@davvd davvd removed the postponed label Jan 18, 2016
@davvd
Copy link

davvd commented Jan 18, 2016

@davvd assign @HDouss please

@krzyk done. @HDouss the task is yours, please go ahead

@HDouss
Copy link
Contributor

HDouss commented Jan 18, 2016

@mkordas The minimal reproducer here would fail because of NewlineAtEndOfFileCheck. That means I cannot add a unit test to make it pass. It won't pass anyway.

@mkordas
Copy link
Contributor Author

mkordas commented Jan 18, 2016

@HDouss can't you just add newline at the end of file but still keep just imports?

@HDouss
Copy link
Contributor

HDouss commented Jan 18, 2016

@mkordas Do you reproduce ArrayIndexOutOfBoundsException in ImportCohesionCheck for such a file ?

@mkordas
Copy link
Contributor Author

mkordas commented Jan 19, 2016

@HDouss In August it was reproducible for me, I don't remember exactly how :) We just need any test case for the issue.

HDouss added a commit to HDouss/qulice that referenced this issue Jan 20, 2016
HDouss added a commit to HDouss/qulice that referenced this issue Jan 20, 2016
@HDouss
Copy link
Contributor

HDouss commented Jan 20, 2016

@mkordas PR #626 reviewed and merged. Please close the issue.

@mkordas
Copy link
Contributor Author

mkordas commented Jan 20, 2016

@HDouss thanks!

@mkordas mkordas closed this as completed Jan 20, 2016
@davvd
Copy link

davvd commented Jan 22, 2016

@HDouss Much obliged! I have added 30 mins to your account in payment "75231569", 72 hours and 20 mins spent

+30 to your rating, your total score is +1352

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

No branches or pull requests

5 participants