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 187529 - Syntax Error in INI causes assert [69cat] AssertionError: Token length=0 <= 0
Summary: Syntax Error in INI causes assert [69cat] AssertionError: Token length=0 <= 0
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Ini files (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 206204 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-14 01:52 UTC by codeslinger_compsalot
Modified: 2012-06-05 10:04 UTC (History)
17 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170660


Attachments
stacktrace (4.09 KB, text/plain)
2010-06-14 01:52 UTC, codeslinger_compsalot
Details
log file for ini edit failure (57.78 KB, text/plain)
2010-07-12 22:33 UTC, codeslinger_compsalot
Details
fix to this bug (2.17 KB, patch)
2010-08-21 07:06 UTC, esminis
Details | Diff
stacktrace (4.08 KB, text/plain)
2010-12-26 19:03 UTC, schkovich
Details
stacktrace (4.08 KB, text/plain)
2011-02-05 22:36 UTC, schkovich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description codeslinger_compsalot 2010-06-14 01:52:45 UTC
This bug was originally marked as duplicate of bug 183463, 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 2010-06-10_03-03-54 )
VM: OpenJDK Client VM, 1.6.0_0-b11, OpenJDK  Runtime Environment, 1.6.0_0-b11
OS: Linux

User Comments:
davido: When i delete a character e.g. comma, only when i use the keybord keys do i see this error message

GUEST: I was editing an .ini file for a PHP project with ZendFramework

GUEST: Backspace after first character in line (ini-File)

davido: editing a text file

schkovich: related to  id #369872

Exception is thrown when the first character on any line is deleted.

codeslinger_compsalot: opened an ini file
selected a character
typed another character to replace it

davido: editing a text file

jakubsacha: When I select the text and hit backspace (in *.ini file)




Stacktrace: 
java.lang.AssertionError: Token length=0 <= 0
   at org.netbeans.lib.lexer.token.DefaultToken.<init>(DefaultToken.java:87)
   at org.netbeans.lib.lexer.LexerInputOperation.createDefaultTokenInstance(LexerInputOperation.java:306)
   at org.netbeans.lib.lexer.LexerInputOperation.createToken(LexerInputOperation.java:284)
   at org.netbeans.spi.lexer.TokenFactory.createToken(TokenFactory.java:105)
   at org.netbeans.spi.lexer.TokenFactory.createToken(TokenFactory.java:89)
   at org.netbeans.modules.languages.ini.IniLexer.nextToken(IniLexer.java:204)
Comment 1 codeslinger_compsalot 2010-06-14 01:52:51 UTC
Created attachment 100046 [details]
stacktrace
Comment 2 Tomas Mysik 2010-06-15 11:02:43 UTC
Unfortunately, I cannot reproduce. Please, reopen this issue, provide exact steps to reproduce and ideally attach a sample INI file. Thanks a lot.

Filipe, please, try to reproduce. Thanks.

Product Version: NetBeans IDE Dev (Build 100614-569f3d05569d)
Java: 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01
System: Linux version 2.6.32-22-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 3 Filip Zamboj 2010-06-15 13:33:03 UTC
(In reply to comment #2)
> Unfortunately, I cannot reproduce. Please, reopen this issue, provide exact
> steps to reproduce and ideally attach a sample INI file. Thanks a lot.
> 
> Filipe, please, try to reproduce. Thanks.

I can't reproduce, exact steps (maybe sample file) would be really helpful

Product Version: NetBeans IDE Dev (Build 100615-e4c5d47cd436)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
Comment 4 codeslinger_compsalot 2010-06-24 18:05:27 UTC
I'm very sorry, but I don't know how to get it into this state either.  I was hoping that the stacktrace would tell you something useful.

all I know is that it happened during a normal edit session.  and that even after I exited netbeans and restarted it, the problem persisted.

But now, I can not reproduce it.

Not sure why/when it stopped being a problem either, because I switched to using a text editor for the ini files and did not reattempt it with netbeans for some time.
Comment 5 codeslinger_compsalot 2010-07-12 22:33:09 UTC
Created attachment 100786 [details]
log file for ini edit failure

it just happened again...   
I created a brand new ini file using the File menu  New/Other/Ini

the file was created fine from the INI Template
it even allowed me to edit the section.  But as soon as I tried to edit/replace the "name = value"  it gave me the assert.


when I tried to "view details" on the automatic bug report generator, it blew up and crashed -- netbeans vanished, all unsaved changes lost.  


A java.lang.AssertionError exception has occurred.
Please report this at http://www.netbeans.org/community/issues.html,
including a copy of your messages.log file as an attachment.
The messages.log file is located in your /home/em/.netbeans/dev/var/log folder.

java.lang.AssertionError: Token length=0 <= 0
	at org.netbeans.lib.lexer.token.DefaultToken.<init>(DefaultToken.java:87)
	at org.netbeans.lib.lexer.LexerInputOperation.createDefaultTokenInstance(LexerInputOperation.java:306)
	at org.netbeans.lib.lexer.LexerInputOperation.createToken(LexerInputOperation.java:284)
	at org.netbeans.spi.lexer.TokenFactory.createToken(TokenFactory.java:105)
	at org.netbeans.spi.lexer.TokenFactory.createToken(TokenFactory.java:89)
	at org.netbeans.modules.languages.ini.IniLexer.nextToken(IniLexer.java:204)
	at org.netbeans.lib.lexer.LexerInputOperation.nextToken(LexerInputOperation.java:193)
	at org.netbeans.lib.lexer.inc.TokenListUpdater.relex(TokenListUpdater.java:622)
	at org.netbeans.lib.lexer.inc.TokenListUpdater.updateRegular(TokenListUpdater.java:279)
	at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate$UpdateItem.update(TokenHierarchyUpdate.java:348)
	at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate.processLevelInfos(TokenHierarchyUpdate.java:223)
	at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate.updateImpl(TokenHierarchyUpdate.java:195)
	at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate.update(TokenHierarchyUpdate.java:133)
	at org.netbeans.lib.lexer.TokenHierarchyOperation.textModified(TokenHierarchyOperation.java:549)
	at org.netbeans.spi.lexer.TokenHierarchyControl.textModified(TokenHierarchyControl.java:96)
	at org.netbeans.lib.lexer.inc.DocumentInput.textModified(DocumentInput.java:154)
	at org.netbeans.lib.lexer.inc.DocumentInput.removeUpdate(DocumentInput.java:147)
	at org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.removeUpdate(PriorityDocumentListenerList.java:102)
	at javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:260)
	at org.netbeans.editor.BaseDocument.fireRemoveUpdate(BaseDocument.java:1664)
	at org.netbeans.editor.BaseDocument.remove(BaseDocument.java:959)
	at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669)
	at javax.swing.text.JTextComponent.replaceSelection(JTextComponent.java:1368)
	at javax.swing.JEditorPane.replaceSelection(JEditorPane.java:1221)
	at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.replaceSelection(BaseKit.java:1170)
	at org.netbeans.editor.BaseKit$DefaultKeyTypedAction$1.run(BaseKit.java:1095)
	at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:344)
	at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1077)
	at org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1067)
	at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1661)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2860)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2895)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2823)
	at java.awt.Component.processEvent(Component.java:5883)
	at java.awt.Container.processEvent(Container.java:2105)
	at java.awt.Component.dispatchEventImpl(Component.java:4467)
	at java.awt.Container.dispatchEventImpl(Container.java:2163)
	at java.awt.Component.dispatchEvent(Component.java:4293)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1881)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:742)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1007)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:879)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:706)
	at java.awt.Component.dispatchEventImpl(Component.java:4337)
	at java.awt.Container.dispatchEventImpl(Container.java:2163)
	at java.awt.Window.dispatchEventImpl(Window.java:2478)
	at java.awt.Component.dispatchEvent(Component.java:4293)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)




I hope you can figure out what is going on here because not being able to create/edit an ini is kinda annoying and crashing during creation of a bug report is even more annoying.
Comment 6 codeslinger_compsalot 2010-07-12 22:38:58 UTC
P.S.  I'm using a dev build 2010-06-10_03-03-54
Comment 7 codeslinger_compsalot 2010-07-12 22:50:05 UTC
okay, the *specific* problem is that I am trying to erase "name" prior to entering a new label.   The editor does not like not having a label.   I can delete all but one character and it will allow me to do this, but as soon as I try to delete the final character it gives the assert.   I also get the assert if I select the name and then type a char to replace it.

[section]
name = value


I can edit the "section" no problem.  I can erase to be:

n = value


no problem.  but then if I try to erase the "n" that is when it asserts.
Comment 8 esminis 2010-08-21 07:06:36 UTC
Created attachment 101577 [details]
fix to this bug

Attached fix.

This was coused by empty name(with name length = 0). I fixed it so that when this happens it will not assert but will mark that row as error, couse this is an ini format error.
Comment 9 codeslinger_compsalot 2010-08-23 18:41:26 UTC
Getting rid of the assert is good, but making assumptions about the syntax and flagging it as an error is bad.

Most INI files do generally follow a certain format, but there is absolutely no requirement that they do this.  

The content of an INI file is arbitrary and totally up to the specific application to decide.

It would be nice if Netbeans supported indenting of selected blocks and perhaps ctrl-; to toggle line commenting.  Beyond that an INI file is strictly a TEXT file and Netbeans should not be making any assumptions about the content.

As a matter of fact, I have written my own INI parser for use by my own programs and it is pretty flexible, for instance it has support for nested sections and HEREDOC content.  

Netbeans will never be able to properly interpret things like this and it should not try to do so because there will always be cases where it is wrong.  There is no *standard* INI syntax, even files in /etc have some app specific variations.
Comment 10 esminis 2010-09-05 17:58:19 UTC
Well error marking might be removed :) Main problem is asertion and crashing Netbeans becouse of assertion.
Comment 11 Filip Zamboj 2010-09-15 12:37:42 UTC
batch reassigning
Comment 12 codeslinger_compsalot 2010-12-07 18:46:34 UTC
I changed the title to more properly reflect the bug
the original title was generated by the automatic bug reporting system.
Comment 13 schkovich 2010-12-26 19:03:44 UTC
Created attachment 104508 [details]
stacktrace

again trying to rename name in new ini file on line 3. instead of overtyping it I tried to delete "name" but that is not possible
Comment 14 schkovich 2010-12-27 00:54:48 UTC
It appears to me that this bug is related to http://netbeans.org/bugzilla/show_bug.cgi?id=191620
Comment 15 schkovich 2011-02-05 22:36:25 UTC
Created attachment 105679 [details]
stacktrace

Cannot delete the first letter of the last line in ini formatted text file
Comment 16 Tomas Mysik 2011-06-03 10:18:52 UTC
Batch reassigning.
Comment 17 Tomas Mysik 2011-09-05 12:33:04 UTC
Fixed, the attached patch applied - thanks for it!

http://hg.netbeans.org/web-main/rev/a23bea458512
Comment 18 Quality Engineering 2011-09-06 14:28:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a23bea458512
User: Tomas Mysik <tmysik@netbeans.org>
Log: #187529 - Syntax Error in INI causes assert [69cat] AssertionError: Token length=0 <= 0

Applied patch provided by esminis@netbeans.org.
Comment 19 Miloslav Metelka 2012-06-05 09:19:52 UTC
*** Bug 206204 has been marked as a duplicate of this bug. ***