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 211792 - [attribute name len > 32k !?!] StringIndexOutOfBoundsException: String index out of range: 933
Summary: [attribute name len > 32k !?!] StringIndexOutOfBoundsException: String index ...
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.2
Hardware: All All
: P2 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
: 212572 212937 213127 213222 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-26 14:54 UTC by mrpc
Modified: 2012-06-28 08:34 UTC (History)
24 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 187408


Attachments
stacktrace (5.26 KB, text/plain)
2012-04-26 14:54 UTC, mrpc
Details
stacktrace (5.15 KB, text/plain)
2012-04-26 15:08 UTC, leek
Details
stacktrace (5.36 KB, text/plain)
2012-05-08 19:53 UTC, augcampos
Details
stacktrace (5.36 KB, text/plain)
2012-05-21 10:00 UTC, augcampos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrpc 2012-04-26 14:54:03 UTC
This bug was originally marked as duplicate of bug 211223, 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 201204240400)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.6-b01-415, Java(TM) SE Runtime Environment, 1.6.0_31-b04-415-11M3635
OS: Mac OS X

User Comments:
mrpc: closing open tabs of a project, while scanning projects was on




Stacktrace: 
java.lang.StringIndexOutOfBoundsException: String index out of range: 933
   at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:879)
   at java.lang.StringBuilder.substring(StringBuilder.java:55)
   at java.lang.AbstractStringBuilder.subSequence(AbstractStringBuilder.java:858)
   at java.lang.StringBuilder.subSequence(StringBuilder.java:55)
   at org.netbeans.modules.html.parser.ElementsFactory$CommonAttribute.name(ElementsFactory.java:854)
   at org.netbeans.modules.html.editor.indexing.HtmlFileModel$ReferencesSearch.visit(HtmlFileModel.java:200)
Comment 1 mrpc 2012-04-26 14:54:08 UTC
Created attachment 118815 [details]
stacktrace
Comment 2 Exceptions Reporter 2012-04-26 15:05:28 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=187408
Comment 3 leek 2012-04-26 15:08:27 UTC
Created attachment 118817 [details]
stacktrace

Sitting idle
Comment 4 Exceptions Reporter 2012-05-07 18:59:51 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=187408
Comment 5 augcampos 2012-05-08 19:53:53 UTC
Created attachment 119176 [details]
stacktrace

scanning php project
Comment 6 Marek Fukala 2012-05-09 11:03:36 UTC
Any chance to get the file causing this problem? I just wonder how it looks like to a tag attribute name is longer than 16k.
Comment 7 augcampos 2012-05-21 10:00:09 UTC
Created attachment 119677 [details]
stacktrace

Open nb first time, import settings from 7.1.1 and only a php project
Comment 8 Marek Fukala 2012-05-21 13:07:12 UTC
*** Bug 212572 has been marked as a duplicate of this bug. ***
Comment 9 Marek Fukala 2012-05-24 10:42:08 UTC
*** Bug 212937 has been marked as a duplicate of this bug. ***
Comment 10 Marek Fukala 2012-05-30 10:32:45 UTC
*** Bug 213222 has been marked as a duplicate of this bug. ***
Comment 11 Marek Fukala 2012-05-30 10:33:16 UTC
*** Bug 213127 has been marked as a duplicate of this bug. ***
Comment 12 Marek Fukala 2012-06-14 10:33:06 UTC
#587028 - provided a reproducible case for:

java.lang.StringIndexOutOfBoundsException: String index out of range: 35
	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:879)
	at java.lang.StringBuilder.substring(StringBuilder.java:55)
	at java.lang.AbstractStringBuilder.subSequence(AbstractStringBuilder.java:858)
	at java.lang.StringBuilder.subSequence(StringBuilder.java:55)
	at org.netbeans.modules.html.parser.ElementsFactory$CommonAttribute.name(ElementsFactory.java:862)
	at org.netbeans.modules.html.parser.ElementsFactory$EmptyOpenTag.getAttribute(ElementsFactory.java:274)
	at org.netbeans.modules.html.editor.gsf.HtmlStructureItem._getAttributeValue(HtmlStructureItem.java:236)
	at org.netbeans.modules.html.editor.gsf.HtmlStructureItem.getAttributeValue(HtmlStructureItem.java:223)
	at org.netbeans.modules.html.editor.gsf.HtmlStructureItem.<init>(HtmlStructureItem.java:87)
Comment 13 Marek Fukala 2012-06-14 10:36:09 UTC
to reproduce, jut put "<a href=""</p>" into an empty php or html file
Comment 14 Marek Fukala 2012-06-14 13:34:36 UTC
the problem reported in ER 587028 has been fixed in web-main#2d7e7f5f528e
Comment 15 Marek Fukala 2012-06-14 14:00:38 UTC
Since 2d7e7f5f528e the html parser validates the element attributes before really puting them to the element's node such issue should not happen since that changeset. So the fix can be considered as the fix for all situations where the html parser code tries to produce some erroneout attribute (which AFAIR happens for erroneous code like as in the source code sample above).

The fix must be put to the 7.2 release!
Comment 16 Vladimir Riha 2012-06-14 14:22:54 UTC
I'll test it and verify it tomorrow if that's OK.
Comment 17 Quality Engineering 2012-06-15 06:15:55 UTC
Integrated into 'main-golden', will be available in build *201206150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2d7e7f5f528e
User: Marek Fukala <mfukala@netbeans.org>
Log: #211792 - bad attributes with wrong offsets/lengths created for html elements under some circumstances
Comment 18 Vladimir Riha 2012-06-15 13:53:41 UTC
The case described in comment #13 is fixed. I tried to edit HTML files with/without stupid syntax errors and no StringIndexOutOfBoundsException was thrown. There is no better reproducible scenario => carefully verifying



Product Version: NetBeans IDE Dev (Build 201206150001)
Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21
System: Linux version 3.0.0-21-generic-pae running on i386; UTF-8; en_US (nb)
Comment 19 Vladimir Riha 2012-06-25 13:00:29 UTC
(In reply to comment #15)
> The fix must be put to the 7.2 release!

Marku, please, if you think it should be in 7.2, can you add the "72_HR_FIX_CANDIDATE" keyword and proceed with integration as described at [1]


[1] http://wiki.netbeans.org/NetBeans_72_HighResistance
Comment 20 Vladimir Riha 2012-06-27 14:22:14 UTC
pending 7.2 verification...
Comment 21 Marek Fukala 2012-06-27 14:58:12 UTC
changeset:   232334:1568688f7dad
branch:      release72
summary:     #211792 - bad attributes with wrong offsets/lengths created for html elements under some circumstances
Comment 22 Quality Engineering 2012-06-28 05:09:21 UTC
Integrated into 'releases', will be available in build *201206272359* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/1568688f7dad
User: Marek Fukala <mfukala@netbeans.org>
Log: #211792 - bad attributes with wrong offsets/lengths created for html elements under some circumstances
Comment 23 Vladimir Riha 2012-06-28 08:34:08 UTC
verified in 7.2

Product Version: NetBeans IDE 7.2 RC1 (Build 201206272359)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.0.0-21-generic-pae running on i386; UTF-8; en_US (nb)