This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248087 - StringIndexOutOfBoundsException: String index out of range: -1
Summary: StringIndexOutOfBoundsException: String index out of range: -1
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Cordova (show other bugs)
Version: 8.0
Hardware: All All
: P1 normal (vote)
Assignee: Vladimir Riha
URL:
Keywords:
: 247692 248025 248112 248191 248228 248268 254114 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-22 03:53 UTC by acs1000
Modified: 2015-08-04 08:37 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 208606


Attachments
stacktrace (1.77 KB, text/plain)
2014-10-22 03:53 UTC, acs1000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description acs1000 2014-10-22 03:53:11 UTC
Build: NetBeans IDE 8.0.1 (Build 201408251540)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.5-b02, Java(TM) SE Runtime Environment, 1.8.0_05-b13
OS: Windows 8

User Comments:
jmfernandez-ctmam: I updated cordova to latest version and since then i can not clean or build my cordova project.

GUEST: Cordova Plugin
Error occured after upgrading cordova version

acs1000: This has happened since I updated to version 8.0.1, and noticed when trying to compile my project.

GUEST: Cordova installed.
Git installed

GUEST: Can't build and run a Cordova Application on IOS Simulator, get this error, nothing happens after.

GUEST: <Please provide a description of the problem or the steps to reproduce

GUEST: clean or trying to build a cordova project

GUEST: cordova build

GUEST: Upgraded to Cordova 3.7 and tried to run application on Android Emulator.




Stacktrace: 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
   at java.lang.String.substring(String.java:1954)
   at org.netbeans.modules.cordova.CordovaPlatform$Version.<init>(CordovaPlatform.java:162)
   at org.netbeans.modules.cordova.CordovaPlatform.getVersion(CordovaPlatform.java:93)
   at org.netbeans.modules.cordova.CordovaPlatform.isReady(CordovaPlatform.java:122)
   at org.netbeans.modules.cordova.CordovaPerformer.perform(CordovaPerformer.java:176)
   at org.netbeans.modules.cordova.platforms.android.AndroidActionProvider.invokeAction(AndroidActionProvider.java:129)
Comment 1 acs1000 2014-10-22 03:53:13 UTC
Created attachment 150038 [details]
stacktrace
Comment 2 Exceptions Reporter 2014-10-22 04:04:56 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=208606
Comment 3 Vladimir Riha 2014-10-22 07:34:40 UTC
Patch candidate. Latest cordova returns 

$ cordova -v
4.0.0

Which causes the SOOBE.
Comment 4 Vladimir Riha 2014-10-22 07:46:36 UTC
FYI, looking at 

$ npm view cordova versions

the change happened with v. 3.7.0
Comment 5 Vladimir Riha 2014-10-22 11:55:04 UTC
*** Bug 247692 has been marked as a duplicate of this bug. ***
Comment 6 Vladimir Riha 2014-10-22 11:56:03 UTC
*** Bug 248025 has been marked as a duplicate of this bug. ***
Comment 7 Vladimir Riha 2014-10-22 13:27:57 UTC
*** Bug 248112 has been marked as a duplicate of this bug. ***
Comment 8 hamil10 2014-10-23 22:44:21 UTC
Out of curiosity, why would the output of 4.0.0 cause this exception?  The version matches the pattern that it's looking for.



(In reply to Vladimir Riha from comment #3)
> Patch candidate. Latest cordova returns 
> 
> $ cordova -v
> 4.0.0
> 
> Which causes the SOOBE.
Comment 9 Exceptions Reporter 2014-10-23 23:44:02 UTC
This bug already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=208606
Comment 10 Vladimir Riha 2014-10-24 06:50:06 UTC
(In reply to hamil10 from comment #8)
> Out of curiosity, why would the output of 4.0.0 cause this exception?  The
> version matches the pattern that it's looking for.

Because it expects "-" as it used to be until 3.7.0, the source code looks like

assert version.contains("-");
api = new SubVersion(version.substring(0, version.indexOf("-")));
cli = new SubVersion(version.substring(version.indexOf("-")+1));

and since there is no "-" now, it throws errors. Cordova used to have versioning like "3.0.0" but last year in October it has changed to "3.1.0-x.x." and now it is back to "4.0.0"
Comment 11 Vladimir Riha 2014-10-24 08:18:51 UTC
Should be fixed now

http://hg.netbeans.org/web-main/rev/d86ff9d12c83
Comment 13 Vladimir Riha 2014-10-27 07:25:19 UTC
*** Bug 248191 has been marked as a duplicate of this bug. ***
Comment 14 Vladimir Riha 2014-10-28 14:52:04 UTC
*** Bug 248228 has been marked as a duplicate of this bug. ***
Comment 15 Quality Engineering 2014-10-29 11:43:57 UTC
Integrated into 'main-silver', will be available in build *201410290913* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d86ff9d12c83
User: Vladimir Riha <vriha@netbeans.org>
Log: #248087 - StringIndexOutOfBoundsException: String index out of range: -1
Comment 16 Quality Engineering 2014-10-29 19:02:38 UTC
Integrated into 'releases/release801', will be available in build *201410291735* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/6bf15a0ac758
User: Vladimir Riha <vriha@netbeans.org>
Log: #248087 - StringIndexOutOfBoundsException: String index out of range: -1
Comment 17 Vladimir Riha 2014-10-30 08:58:39 UTC
*** Bug 248268 has been marked as a duplicate of this bug. ***
Comment 18 elennaro 2014-10-30 19:03:43 UTC
Untill the stable version will be released, is there any way to workaround this bug?
Comment 19 elennaro 2014-10-30 19:09:40 UTC
Wow! I love Netbeans!
You guys Rock!
Few minutes ago I've found an update of Cordova plugin in Options-> plugins -> Check for update!
It works now!
Comment 20 Vladimir Riha 2014-10-30 19:46:59 UTC
Yep, the patch was released today :-)
Comment 21 RichardCheung 2014-11-06 12:40:48 UTC
I have upgraded the Cordova Support Plugin to 1.26.2

	org.netbeans.modules.cordova.platforms [1.32.1 201408251540]
	org.netbeans.modules.cordova.platforms.ios [1.24.1 201408251540]
	org.apache.tools.ant.module/3 [3.76.1.2 2 201408251540]
	org.netbeans.modules.cordova.platforms.android [1.24.1 201408251540]
	org.netbeans.modules.cordova [1.26.2 201410291735]

However, I am still facing the Cordova or Git was missing dialog.

Here are my spec:

$ which git
/usr/local/bin/git

$ git --version
git version 1.9.1

$ which cordova
/usr/local/bin/cordova

$ cordova --version
4.0.0

OS: Mac OS X 10.9.5

NetBeans IDE 8.0.1

Folk, any suggestions?
Comment 22 Vladimir Riha 2014-11-06 12:47:00 UTC
Could you please file a new bug and attach your IDE log (see http://wiki.netbeans.org/FaqLogMessagesFile ) from moment when you see the messages? The cause will be different than the one in this issue so it is better to track it separately.  

Thank you
Comment 23 Vladimir Riha 2014-11-11 09:46:55 UTC
Verified in patch

Product Version: NetBeans IDE 8.0.2 (Build 201411102027)
Java: 1.8.0_25; Java HotSpot(TM) Client VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 24 Roman Svitanic 2015-08-04 08:37:04 UTC
*** Bug 254114 has been marked as a duplicate of this bug. ***