Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: FLEX-1.1
-
Fix Version/s: None
-
Component/s: Flex
-
Labels:None
-
Environment:Sonar 3.1.1
-
Number of attachments :
Description
I updated the flex plugin to 1.1 and started getting IllegalArgumentException while analizing flex project with sonar. it worked well with Flex plugin version 1.0.1
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project cartopia-main: Can not execute Sonar: java.lang.IllegalArgumentException: fromIndex(282) > toIndex(0) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project cartopia-main: Can not execute Sonar
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.sonar.api.utils.SonarException: java.lang.IllegalArgumentException: fromIndex(282) > toIndex(0)
at org.sonar.plugins.flex.flexpmd.FlexPmdSensor.analyse(FlexPmdSensor.java:65)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
at org.sonar.batch.phases.Phases.execute(Phases.java:93)
at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:139)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:115)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110)
at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:105)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:111)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:142)
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
... 23 more
Caused by: java.lang.IllegalArgumentException: fromIndex(282) > toIndex(0)
at java.util.SubList.<init>(AbstractList.java:604)
at java.util.RandomAccessSubList.<init>(AbstractList.java:758)
at java.util.AbstractList.subList(AbstractList.java:468)
at com.adobe.ac.pmd.files.impl.MxmlFile.extractMetaDataLines(MxmlFile.java:260)
at com.adobe.ac.pmd.files.impl.MxmlFile.copyScriptLinesKeepingOriginalLineIndices(MxmlFile.java:189)
at com.adobe.ac.pmd.files.impl.MxmlFile.extractScriptBlock(MxmlFile.java:291)
at com.adobe.ac.pmd.files.impl.MxmlFile.<init>(MxmlFile.java:52)
at com.adobe.ac.pmd.files.impl.FileUtils.create(FileUtils.java:87)
at com.adobe.ac.pmd.files.impl.FileUtils.computeFilesList(FileUtils.java:56)
at com.adobe.ac.pmd.FlexPmdViolations.computeFiles(FlexPmdViolations.java:162)
at com.adobe.ac.pmd.FlexPmdViolations.computeViolations(FlexPmdViolations.java:84)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.computeViolations(AbstractFlexPmdEngine.java:142)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.executeReport(AbstractFlexPmdEngine.java:119)
at org.sonar.plugins.flex.flexpmd.FlexPmdSensor.execute(FlexPmdSensor.java:85)
at org.sonar.plugins.flex.flexpmd.FlexPmdSensor.analyse(FlexPmdSensor.java:63)
... 37 more
Issue Links
- duplicates
-
SONARPLUGINS-2207
flex pmd mxml file incorrectly identifies script and metadata blocks
-
I had the same problem and the ovbious coarse workaround (analyze only *.as files) didn't work for me: FlexPmd seems to ignore these setting.
I even wasn't able to successfully exclude mxml-files from FlexPmd-processing by use of "sonar.exclusions".
Therefore I did some more analysis and found that FlexPmd stumbles over a line containing the string "Metadata" in an mxml-file.
In my case it was a Swiz-config containing "<processors:InspectableMetadataProcessorArray/>".
As a workaround I removed that part of the Swiz-config because it is currently not used anyway.
A far better workaround would be, to exclude the file in question from the FlexPmd analysis, which I didn't accomplished.