Skip to main content
Participating Frequently
September 7, 2009
Question

Fails in a large codebase - java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  • September 7, 2009
  • 1 reply
  • 2199 views

Hi, I'm trying to use Flex PMD in a large Flex codebase. It seems to work fine with smaller projects but I have one pretty large project and both if I run it from ant or command line it fails with a pretty generic error. I thought I would check if anyone has run into this error before. This is the output from the console window (I ran the ant task from within Flex Builder).

flexPmdWithDefaultRuleset:
  [flexPmd] Sep 7, 2009 10:55:55 AM com.adobe.ac.pmd.engines.AbstractFlexPmdEngine loadRuleset
  [flexPmd] INFO: Ruleset: C:\Users\Andy\AppData\Local\Temp\all_flex62150.xml
  [flexPmd] Sep 7, 2009 10:55:55 AM com.adobe.ac.pmd.engines.AbstractFlexPmdEngine loadRuleset
  [flexPmd] INFO: Rules number in the ruleSet: 84
  [flexPmd] Sep 7, 2009 10:55:55 AM com.adobe.ac.pmd.FlexPmdViolations computeViolations
  [flexPmd] INFO: computing RulesList
  [flexPmd] Sep 7, 2009 10:55:55 AM com.adobe.ac.pmd.FlexPmdViolations computeViolations
  [flexPmd] INFO: computing FilesList
  [flexPmd] Sep 7, 2009 10:56:23 AM com.adobe.ac.pmd.FlexPmdViolations computeViolations
  [flexPmd] INFO: computing Asts

BUILD FAILED
C:\Projects\src\MyAppClient\build.xml:345: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Has anyone seen anything like it?

I figured the error is so generic that I have to try to figure it out myself. Any ideas how to debug the issue? Just set a breakpoint in com.adobe.ac.pmd.FlexPmdViolations?

TIA,

Magnus

This topic has been closed for replies.

1 reply

Adobe Employee
September 8, 2009

Hi,

I resolved some bugs related to this in trunk.

Those fixes will be in RC4.

Can you try to download the source?

Xavier

TexMagsAuthor
Participating Frequently
September 8, 2009

Great, I'll download the source and try it as soon as I get a chance and get back to you.

Thanks,

Magnus

TexMagsAuthor
Participating Frequently
September 24, 2009

I've tried with the latest RC 4 but unfortunately it still fails with the error:

Buildfile: C:\Projects\src\MyProject\build.xml
flexPmdWithDefaultRuleset:
  [flexPmd] Sep 24, 2009 8:30:15 AM com.adobe.ac.pmd.engines.AbstractFlexPmdEngine loadRuleset
  [flexPmd] INFO: Ruleset: C:\DOCUME~1\JohnDoe\LOCALS~1\Temp\all_flex6008.xml
  [flexPmd] Sep 24, 2009 8:30:15 AM com.adobe.ac.pmd.engines.AbstractFlexPmdEngine loadRuleset
  [flexPmd] INFO: Rules number in the ruleSet: 84

BUILD FAILED
C:\Projects\src\MyProject\build.xml:430: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

It seems like it fails earlier on in the process with RC4 than RC3 as you can see in the output. I haven't looked at the source in detail of Flex PMD, if it's possible to improve the error handling and get a more descriptive error of where in Flex PMD it fails, maybe we could figure out exactly why it fails.

I haven't been able to run all of the Flex PMD projects from the source but I will give it another shot with this release later this week and see if I can get any further.

TIA,

Magnus