Bug 236317 - [74cat] Throwable at org.netbeans.modules.editor.fold.FoldChildren.insertImpl
Summary: [74cat] Throwable at org.netbeans.modules.editor.fold.FoldChildren.insertImpl
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Code folding (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: NO74
Depends on:
Blocks:
 
Reported: 2013-09-24 11:12 UTC by muellermi
Modified: 2013-12-05 11:17 UTC (History)
32 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 204105


Attachments
stacktrace (2.13 KB, text/plain)
2013-09-24 11:12 UTC, muellermi
Details
stacktrace (2.13 KB, text/plain)
2013-09-25 10:33 UTC, Marek Fukala
Details
stacktrace (2.20 KB, text/plain)
2013-09-28 00:15 UTC, janario
Details
stacktrace (2.20 KB, text/plain)
2013-09-28 00:18 UTC, janario
Details
stacktrace (7.09 KB, text/plain)
2013-09-28 00:21 UTC, janario
Details
stacktrace (2.20 KB, text/plain)
2013-10-01 06:36 UTC, mrpc
Details
stacktrace (2.13 KB, text/plain)
2013-10-01 11:27 UTC, mslama
Details
stacktrace (2.13 KB, text/plain)
2013-10-01 11:30 UTC, mslama
Details
stacktrace (2.13 KB, text/plain)
2013-10-01 11:33 UTC, mslama
Details
stacktrace (2.20 KB, text/plain)
2013-10-03 19:36 UTC, Maksim Khramov
Details
stacktrace (2.20 KB, text/plain)
2013-10-07 22:28 UTC, cwt137
Details
stacktrace (2.13 KB, text/plain)
2013-10-10 14:31 UTC, Tomas Mysik
Details
stacktrace (2.20 KB, text/plain)
2013-10-10 17:43 UTC, cwt137
Details

Note You need to log in before you can comment on or make changes to this bug.
Description muellermi 2013-09-24 11:12:43 UTC
This bug was originally marked as duplicate of bug 236045, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 201309240002)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.0-b56, Java(TM) SE Runtime Environment, 1.7.0_40-b43
OS: Windows 7

User Comments:
ionuion: edited javascript inside html file

nickdick74: Editing JSF page. It happens, for instance, when you open a tag and you start typing inside it. Auto completion happens but often, while typing to complete such tag, the error occours. 
Sometimes, it happens during autocompletion of managed beans properties.

muellermi: edit jsf page

mkroll: Work with the editor tab

vriha: Typing ${ in JSP file

gtzabari: Moved caret in editor. Exception thrown.

muellermi: ... or just keying some chars :(

muellermi: ... or after pasting some chars ...

muellermi: Bug still exists in latest build (20130924...)

brettryan: This is still a problem in latest DEV build.

tnleeuw: Typing in JavaScript; entering config object for a method and entered a '{' to begin a nested config object

brettryan: Will not let me access the editor, just keeps coming up.

michbarsinai: wrote a logical AND while editing JSF:
<c:if test="#{bean.method() & {BOOM}

GUEST: s

GUEST: Not sure

muellermi: Still whilst editing JSF page. After code completition.

muellermi: After some of these crashes appeard, furthor eiting seems to be impossible.

muellermi: editing JSF page




Stacktrace: 
java.lang.Throwable
   at org.netbeans.modules.editor.fold.FoldChildren.insertImpl(FoldChildren.java:247)
   at org.netbeans.modules.editor.fold.FoldChildren.insertImpl(FoldChildren.java:227)
   at org.netbeans.modules.editor.fold.FoldChildren.replaceByChildren(FoldChildren.java:215)
   at org.netbeans.api.editor.fold.Fold.replaceByChildren(Fold.java:377)
   at org.netbeans.api.editor.fold.FoldHierarchy$ApiPackageAccessorImpl.foldReplaceByChildren(FoldHierarchy.java:398)
   at org.netbeans.modules.editor.fold.FoldHierarchyTransactionImpl.removeFoldFromHierarchy(FoldHierarchyTransactionImpl.java:1004)
Comment 1 muellermi 2013-09-24 11:12:46 UTC
Created attachment 140412 [details]
stacktrace
Comment 2 Marek Fukala 2013-09-25 10:33:40 UTC
Created attachment 140447 [details]
stacktrace

editing a json file, nothing extraordinarly complex though:

{
    "elements": {
        "foo": {
            "parent": null,
            "attributes": {
                "cool": "boolean",
                "id": "id"
            }
        },
        "infoo": {
            "parent" : "foo"
        }
    }
    ,
    "attributes": {
            "one": {
                "parent" : null
            }
    }

}

I think I've added a brace before and "one" element
Comment 3 Marek Fukala 2013-09-25 11:36:29 UTC
100% reproducible on following sample. Just type "{" at the pipe position.

{
    "elements": {
        "foo": {
            "parents": null,
            "attributes": {
                "cool": "boolean",
                "id": "id"
            },
            
            "elements": {
                "infoo":{
                    
                }
            }
        },
        
        
        "infoo2": {
            "parent" : "foo"
        },
        
        "infoo3": {
            "parent" : |
        }
    }
    ,
    "attributes": {
            "one": {
                "parent" : null
            }
    }

}
Comment 4 theshadow27 2013-09-26 20:40:14 UTC
I got this while editing a Java class in dev 13-09-26. Have not been able to reproduce reliably, still trying.
Comment 5 janario 2013-09-28 00:15:44 UTC
Created attachment 140587 [details]
stacktrace

.
Comment 6 janario 2013-09-28 00:18:44 UTC
Created attachment 140588 [details]
stacktrace

.
Comment 7 janario 2013-09-28 00:21:44 UTC
Created attachment 140589 [details]
stacktrace

.
Comment 8 muellermi 2013-09-30 09:17:41 UTC
still same annoying problem with latest buil (20130930...)
Comment 9 muellermi 2013-09-30 09:18:57 UTC
This problem occurs if I edit a JSF page (maybe HTML in general)
There is no such problem, whilst editing Java source.
Comment 10 mrpc 2013-10-01 06:36:49 UTC
Created attachment 140677 [details]
stacktrace

I was editing a php/html file. I am not sure, but I think this happened when I entered <p> and netbeans autocompleted the </p> tag.
Comment 11 mslama 2013-10-01 11:27:49 UTC
Created attachment 140686 [details]
stacktrace

Edit jsp
Comment 12 mslama 2013-10-01 11:30:49 UTC
Created attachment 140687 [details]
stacktrace

Edit jsp
Comment 13 mslama 2013-10-01 11:33:50 UTC
Created attachment 140688 [details]
stacktrace

Edit jsp
Comment 14 Exceptions Reporter 2013-10-01 11:33:57 UTC
This bug already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=204105
Comment 15 Marian Mirilovic 2013-10-02 15:47:41 UTC
Svata, 
could you please look at this as soon as possible ? With 50+ dups in last 13 days, it became pretty serious issue ... Thanks in advance
Comment 16 Svata Dedic 2013-10-03 06:55:58 UTC
Although the bug is marked as [74cat] and there's indeed a defect valid for 7.4 the issue is not so highly visible in 7.4. 
I've added additional sanity checks into the dev version. All entries in this exception report actually come from dev version.
Comment 17 Marian Mirilovic 2013-10-03 07:36:03 UTC
(In reply to Svata Dedic from comment #16)
> Although the bug is marked as [74cat] and there's indeed a defect valid for
> 7.4 the issue is not so highly visible in 7.4. 
> I've added additional sanity checks into the dev version. All entries in
> this exception report actually come from dev version.

Ok, thanks for evaluation.
Comment 18 Maksim Khramov 2013-10-03 19:36:57 UTC
Created attachment 140776 [details]
stacktrace

typing text for pattern value in jsf xhtml code:
<f:convertDateTime pattern="DD MM"
Comment 19 Marek Fukala 2013-10-04 05:39:35 UTC
(In reply to Svata Dedic from comment #16)
> Although the bug is marked as [74cat] and there's indeed a defect valid for
> 7.4 the issue is not so highly visible in 7.4. 
> I've added additional sanity checks into the dev version. All entries in
> this exception report actually come from dev version.
BTW have you noticed the 100% reproducible case in comment#3?
Comment 20 cwt137 2013-10-07 22:28:05 UTC
Created attachment 140872 [details]
stacktrace

was taking out a try/catch block in my PHP code and got this error
Comment 21 Tomas Mysik 2013-10-10 14:31:11 UTC
Created attachment 140981 [details]
stacktrace

change:
if (file.match(//) == null) {
to:
if (file.match(/ /) == null) {
Comment 22 cwt137 2013-10-10 17:43:11 UTC
Created attachment 140986 [details]
stacktrace

Changed a <button> tag into a <input> tag. Decided to go back to the original tag and did Ctrl-Z a few times and got this error once I got to the original code.
Comment 23 Svata Dedic 2013-10-15 19:53:54 UTC
The defect can be also reproduced by running automatic Fold random manager test. It seems the UNDO operation is a culprit. the Undo operation does not fire pre-change events. So updates of folds affected by 'remove' operation do not work well. Furthermore the undo seems to restore some Positions to their previous state, but the hierarchy might have changed since then including reparenting a fold. The data become damaged and the affected fold cannot be found using binary search.
Comment 24 Svata Dedic 2013-10-16 07:46:37 UTC
invalid state during remove/replaceByChildren reported by exception reports and automatic test seems fixed. Marek's testcase in comment #3 is fixed by a change in FoldOperationImpl.Refresher that prevents bounds update if the fold contains some children - rev. http://hg.netbeans.org/jet-main/reva1b86e5a5a03
Comment 25 victork 2013-10-23 09:27:11 UTC
While most of the issue is really resolved now with Svata's latest patch there seems to be some leftout part of this which is still not fixed. It occurs relatively rare(Unlike the already fixed parts which occured a lot).

Stacktraces are the same(Only offsets slightly changed due to code updates) and located here:

http://statistics.netbeans.org/analytics/detail.do?id=204105

While i'm not sure about builds 131010-131015, builds 131020+ have your last fix applied for sure(I build it myself and know the changes which got in - almost no fold exceptions also indicate it is in) - As you see there is some small case of this folding bug which is not catched yet and reported by only 2 users meantime(Much smaller error-rate than before).
Comment 26 Svata Dedic 2013-12-05 11:17:25 UTC
See issue #238175; I almost completely changed the matching code; available from build 2013-11-24.