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 185091 - Exception thrown after text pasted into FXD source editor
Summary: Exception thrown after text pasted into FXD source editor
Status: RESOLVED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Andrew Korostelev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-27 12:49 UTC by pbenes
Modified: 2010-04-28 14:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Invalid FXD content causing lexer crash (467 bytes, application/octet-stream)
2010-04-27 12:58 UTC, pbenes
Details
fxviewer_error.JPG (38.24 KB, image/jpeg)
2010-04-28 12:35 UTC, Andrew Korostelev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pbenes 2010-04-27 12:49:09 UTC
After I have pasted the text

"DelegateShape {
             shape: bind geom
             fill: Color.BLUE
         }"

the following exception appeared:

java.lang.IndexOutOfBoundsException: Index: 170, Size: 170
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.get(ArrayList.java:322)
	at org.netbeans.modules.javafx.fxd.composer.lexer.FXDLexer.getNextTokenData(FXDLexer.java:128)
	at org.netbeans.modules.javafx.fxd.composer.lexer.FXDLexer.nextToken(FXDLexer.java:110)
	at org.netbeans.lib.lexer.LexerInputOperation.nextToken(LexerInputOperation.java:190)
	at org.netbeans.lib.lexer.BatchTokenList.tokenOrEmbeddingImpl(BatchTokenList.java:175)
	at org.netbeans.lib.lexer.BatchTokenList.tokenOrEmbedding(BatchTokenList.java:170)
	at org.netbeans.api.lexer.TokenSequence.moveNext(TokenSequence.java:454)
	at org.netbeans.modules.javafx.fxd.composer.editor.parser.FXDSyntaxErrorParser$FXDParserResult.getSyntaxErrors(FXDSyntaxErrorParser.java:107)
	at org.netbeans.modules.javafx.fxd.composer.editor.SyntaxErrorsHighlightingTask.run(SyntaxErrorsHighlightingTask.java:76)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:655)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[catch] at java.lang.Thread.run(Thread.java:619)


I have not tried it with 6.9 beta though, but with my development build.
Comment 1 pbenes 2010-04-27 12:56:39 UTC
It seems to be triggered by the exception

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:686)
	at com.sun.javafx.tools.fxd.FXDReference.parse(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.ContentListener$ContentLexerImpl.createReference(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseValue(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseValue(Unknown Source)
	at org.netbeans.modules.javafx.fxd.composer.lexer.FXDLexer$ContentLexerImpl.attributeValue(FXDLexer.java:262)
	at com.sun.javafx.tools.fxd.container.scene.fxd.ContentListener$ContentLexerImpl.attributeValue(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseObjectImpl(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.nextValue(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseArray(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.nextValue(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseObjectImpl(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseObject(Unknown Source)
	at com.sun.javafx.tools.fxd.container.scene.fxd.FXDParser.parseObject(Unknown Source)
	at org.netbeans.modules.javafx.fxd.composer.lexer.FXDLexer.buildTokensList(FXDLexer.java:86)
	at org.netbeans.modules.javafx.fxd.composer.lexer.FXDLexer.nextToken(FXDLexer.java:107)
	at org.netbeans.lib.lexer.LexerInputOperation.nextToken(LexerInputOperation.java:190)
	at org.netbeans.lib.lexer.BatchTokenList.tokenOrEmbeddingImpl(BatchTokenList.java:175)
	at org.netbeans.lib.lexer.BatchTokenList.tokenOrEmbedding(BatchTokenList.java:170)
	at org.netbeans.api.lexer.TokenSequence.moveNext(TokenSequence.java:454)
	at org.netbeans.modules.javafx.fxd.composer.editor.parser.FXDSyntaxErrorParser$FXDParserResult.getSyntaxErrors(FXDSyntaxErrorParser.java:107)
	at org.netbeans.modules.javafx.fxd.composer.editor.SyntaxErrorsHighlightingTask.run(SyntaxErrorsHighlightingTask.java:76)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:655)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[catch] at java.lang.Thread.run(Thread.java:619)

which is fxdloader reaction to invalid FXD content (attached). This is not ideal situation, but still lexer should not crash like this, but rather mark the content as invalid (red?).
Comment 2 pbenes 2010-04-27 12:58:00 UTC
Created attachment 98136 [details]
Invalid FXD content causing lexer crash
Comment 3 Andrew Korostelev 2010-04-28 12:35:26 UTC
Created attachment 98200 [details]
fxviewer_error.JPG

error is in fxd loader.
It fails on parsing value "bind geom".
The same is reproducible with fx viewer (see attache screenshot).

the only think I can do is to catch and correctly process this exception.
Comment 4 pbenes 2010-04-28 13:06:35 UTC
Yes, agreed.
Comment 5 Andrew Korostelev 2010-04-28 14:49:12 UTC
fixed in trunk.
http://hg.netbeans.org/javafx/rev/8265947abf93

IndexOutOfBoundsException is processed as syntax error with message "Syntax is not supported by parser.\nFaild to parse with exception: {0}".
I can give more specific message about not supported "bind" in attribute value, but not sure described case is the only possible.