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 227538 - IllegalArgumentException: (endOffset=19219 - startOffset=19218) < (startGuardedLength=1 + endGuardedLength=1)
Summary: IllegalArgumentException: (endOffset=19219 - startOffset=19218) < (startGuard...
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-15 16:30 UTC by padraigdoran
Modified: 2013-03-23 01:57 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 22969


Attachments
stacktrace (2.05 KB, text/plain)
2013-03-15 16:30 UTC, padraigdoran
Details
Strawman's fix of the issue (633 bytes, patch)
2013-03-15 17:30 UTC, Svata Dedic
Details | Diff
stacktrace (2.05 KB, text/plain)
2013-03-16 20:03 UTC, tomjnsn
Details
stacktrace (2.05 KB, text/plain)
2013-03-17 05:51 UTC, drazisil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description padraigdoran 2013-03-15 16:30:41 UTC
Build: NetBeans IDE Dev (Build 2013-03-14 09:46:40 WEB-MAIN bacf3f326fcd by Padraig Doran)
VM: Java HotSpot(TM) Client VM, 23.7-b01, Java(TM) SE Runtime Environment, 1.7.0_17-b02
OS: Windows 7

User Comments:
padraigdoran: mistaken extra parentesis here
if (!isset($subject_id)))

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




Stacktrace: 
java.lang.IllegalArgumentException: (endOffset=19219 - startOffset=19218) < (startGuardedLength=1 + endGuardedLength=1)
   at org.netbeans.api.editor.fold.Fold.<init>(Fold.java:131)
   at org.netbeans.api.editor.fold.FoldHierarchy$ApiPackageAccessorImpl.createFold(FoldHierarchy.java:371)
   at org.netbeans.modules.editor.fold.FoldOperationImpl.createFold(FoldOperationImpl.java:170)
   at org.netbeans.spi.editor.fold.FoldOperation.addToHierarchy(FoldOperation.java:204)
   at org.netbeans.modules.editor.fold.FoldOperationImpl$Refresher.run(FoldOperationImpl.java:659)
   at org.netbeans.modules.editor.fold.FoldOperationImpl.update(FoldOperationImpl.java:483)
Comment 1 padraigdoran 2013-03-15 16:30:44 UTC
Created attachment 132664 [details]
stacktrace
Comment 2 Svata Dedic 2013-03-15 17:04:21 UTC
Reproduced
Comment 3 Svata Dedic 2013-03-15 17:29:11 UTC
The root cause is that PHP reports 'code block' fold, which is defined as surrounded by 2 chars (i.e. {}), but the reported block is just 1 character long. 

The previous implementation had silently filtered such invalid data, hiding the error. I would prefer not hiding the error out again. Please see the attached proposed patch for a simple fix for this case.

I recommend also not to create folds for single-statement if-else branches; or more precise for single-line branches as done in <= 7.3.
Comment 4 Svata Dedic 2013-03-15 17:30:15 UTC
Created attachment 132666 [details]
Strawman's fix of the issue
Comment 5 Exceptions Reporter 2013-03-16 05:12:30 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=22969
Comment 6 tomjnsn 2013-03-16 20:03:44 UTC
Created attachment 132683 [details]
stacktrace

editing a php file.
Comment 7 drazisil 2013-03-17 05:51:44 UTC
Created attachment 132708 [details]
stacktrace

Had just typed 

for ($item = 0; $item < $this->rssItemCount; $i)
Comment 8 Ondrej Brejla 2013-03-18 09:48:17 UTC
Fixed in web-main #2517e6bb3263
Comment 9 Quality Engineering 2013-03-19 02:01:42 UTC
Integrated into 'main-golden', will be available in build *201303182300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2517e6bb3263
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #227538 - IllegalArgumentException: (endOffset=19219 - startOffset=19218) < (startGuardedLength=1 + endGuardedLength=1)
Comment 10 padraigdoran 2013-03-19 11:28:29 UTC
Not fixed. Still getting exceptions (reported them: "It has now been added to the database with id #665717. It has been classified as a duplicate of report #22969")

I did a build from here, which is later than the fixed changeset:

changeset:   248393:c36b59f8d48f
tag:         tip
user:        Ondrej Brejla <obrejla@netbeans.org>
date:        Tue Mar 19 07:57:26 2013 +0100
summary:     Fixed failing tests.
Comment 11 Ondrej Brejla 2013-03-19 11:40:02 UTC
Sorry, but I'm not able to reproduce that in todays dev build with your example. Can you provide exact steps, how to do that? Thanks in advance. Then simply reopen.

Product Version: NetBeans IDE Dev (Build 20130319-c36b59f8d48f)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
Runtime: Java(TM) SE Runtime Environment 1.6.0_26-b03
System: Linux version 3.5.0-25-generic running on i386; UTF-8; cs_CZ (nb)
Comment 12 Martin Kanak 2013-03-19 11:48:09 UTC
I am also not be able to reproduce this issue in todays dev build

Product Version: NetBeans IDE Dev (Build 201303182300)
Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Linux version 3.5.0-25-generic running on i386; UTF-8; en_US (nb)
Comment 13 Ondrej Brejla 2013-03-20 08:17:59 UTC
Fixed in web-main #310f68bfa393
Comment 14 Quality Engineering 2013-03-23 01:57:52 UTC
Integrated into 'main-golden', will be available in build *201303222300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/310f68bfa393
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #227538 - IllegalArgumentException: (endOffset=19219 - startOffset=19218) < (startGuardedLength=1 + endGuardedLength=1)