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 240826 - IllegalStateException: Lexer org.netbeans.modules.groovy.gsp.lexer.GspLexer@2a9ee93 returned null token but lexerInput.readLength()=2 lexer-state: GEND_TAG tokenStartOffset=945, readOffset=947,
Summary: IllegalStateException: Lexer org.netbeans.modules.groovy.gsp.lexer.GspLexer@2...
Status: VERIFIED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: GSP (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: bruno.flavio
URL:
Keywords:
: 244664 246348 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-22 15:04 UTC by ckoebke
Modified: 2016-02-08 23:50 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 85298


Attachments
stacktrace (5.54 KB, text/plain)
2014-01-22 15:04 UTC, ckoebke
Details
stacktrace (5.46 KB, text/plain)
2014-09-04 13:05 UTC, jherkel
Details
stacktrace (5.45 KB, text/plain)
2014-09-05 21:11 UTC, Maksim Khramov
Details
Proposed patch: keep tokenizing the input. (1.12 KB, patch)
2015-03-15 21:05 UTC, bruno.flavio
Details | Diff
stacktrace (5.45 KB, text/plain)
2015-07-08 14:43 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ckoebke 2014-01-22 15:04:10 UTC
Build: NetBeans IDE 7.4 (Build 201310111528)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.45-b08, Java(TM) SE Runtime Environment, 1.7.0_45-b18
OS: Linux

User Comments:
GUEST: Add a html comment to the start of a php file. Went Bang on the ! key.

GUEST: when i tried to write <!D , the program, not allow me write it.

GUEST: Accidentally hit the \ key followed by the enter key instead of just enter after the closing brace of a constructor definition

ckoebke: Open a <g:if> tag with a condition and try to close it inside a file, that does not contain the normal HTML structure.

<g:if test="${!key}">
    <g:set var="key" value="pageIndex" />
</g:if>

<g:if test="${pageIndex}">
    <div class="text-center">
        <ul class="pagination pagination-sm">
            <g:if test="${pageIndex > 0}">
                <li>
                    <a href="${createLink(action: actionName, params: params + [(key): pageIndex - 1])}">Previous</a>
                </li>
            </g:if>
            <g:each in="${(pageIndex-5)..(pageIndex+5)}">
                <g:if test="${it >= 0 && it < pageCount}">
                    <li ${it == pageIndex ? 'class="active"' : ""}>
                        <a href="${createLink(action: actionName, params: params + [(key): it])}">${it + 1}</a>
                    </li>
                </g:if>
            </g:each>
            <g:if test="${pageIndex + 1 < pageCount}">
                <li>
                    <a href="${crea

GUEST: adding a line of code to a file that had previosly been moved from parent folder to sub folder.

GUEST: I typed

<!DOCTYPE html{SPACEBAR}

in a html document!

P.S.: {SPACEBAR} is the key on my keyboard ;)

GUEST: In HTML-Editor trying to type "<!--" before "TODO" but this Error comes immediately after "<"




Stacktrace: 
java.lang.IllegalStateException: Lexer org.netbeans.modules.groovy.gsp.lexer.GspLexer@2a9ee93
  returned null token but lexerInput.readLength()=2
  lexer-state: GEND_TAG
  tokenStartOffset=945, readOffset=947, lookaheadOffset=948
  Chars: "\n\n" - these characters need to be tokenized.
Fix the lexer to not return null token in this state.
   at org.netbeans.lib.lexer.LexerInputOperation.checkLexerInputFinished(LexerInputOperation.java:452)
   at org.netbeans.lib.lexer.LexerInputOperation.nextToken(LexerInputOperation.java:212)
   at org.netbeans.lib.lexer.inc.TokenListUpdater.relex(TokenListUpdater.java:627)
   at org.netbeans.lib.lexer.inc.TokenListUpdater.updateRegular(TokenListUpdater.java:280)
   at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate$UpdateItem.update(TokenHierarchyUpdate.java:351)
   at org.netbeans.lib.lexer.inc.TokenHierarchyUpdate.processLevelInfos(TokenHierarchyUpdate.java:226)
Comment 1 ckoebke 2014-01-22 15:04:12 UTC
Created attachment 144253 [details]
stacktrace
Comment 2 jherkel 2014-09-04 13:05:04 UTC
Created attachment 149037 [details]
stacktrace

I edited html code, there was a problem with space between attributes, something like rendered="#{aaa==true}"value="#{bbb}"
Comment 3 Exceptions Reporter 2014-09-04 13:05:09 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=85298
Comment 4 Miloslav Metelka 2014-09-05 07:34:55 UTC
Groovy lexer should be fixed to tokenize remaining chars of the input.
Comment 5 Maksim Khramov 2014-09-05 21:11:04 UTC
Created attachment 149056 [details]
stacktrace

Edit JSF xhtml file.
Cursoe inside empty JSF expression #{}
Press \
Comment 6 bruno.flavio 2015-03-07 20:01:16 UTC
Bug verification procedure:

1. Create new grails project;
2. Open "Views and layouts"->error.gsp
3. In the end of the file, after "</html>", attempt to write anything.

Raises the exception reported: "java.lang.IllegalStateException: Lexer org.netbeans.modules.groovy.gsp.lexer.GspLexer@52f828d2
  returned null token but lexerInput.readLength()=2"
Comment 7 bruno.flavio 2015-03-15 21:05:17 UTC
Created attachment 152629 [details]
Proposed patch: keep tokenizing the input.

As with the JSP lexer, this patch defines an ERROR token and returns it when the output can't be further tokenized.
Comment 8 MackSix 2015-07-08 14:43:55 UTC
Created attachment 154527 [details]
stacktrace

Editing a JFS XHTML file. 

<p><h:outputText value="#{moreSports. }" and cursor was to the right of moreSports. with code complete window up. I hit backspace and this exception was thrown. 

It's possible I het the | key instead of backspace. Will try to reproduce.
Comment 9 MackSix 2015-07-08 14:48:42 UTC
(In reply to MackSix from comment #8)
> Created attachment 154527 [details]
> stacktrace
> 
> Editing a JFS XHTML file. 
> 
> <p><h:outputText value="#{moreSports. }" and cursor was to the right of
> moreSports. with code complete window up. I hit backspace and this exception
> was thrown. 
> 
> It's possible I het the | key instead of backspace. Will try to reproduce.

Reproducible as per Comment 5.

This is a JSF XHTML file and I am not using Groovy.


Product Version: NetBeans IDE Dev (Build 201507040001)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b15
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 10 Martin Janicek 2015-07-22 08:16:17 UTC
Patch seems to be OK. Thanks Bruno!
Comment 11 Jiri Kovalsky 2015-08-19 22:13:15 UTC
http://hg.netbeans.org/core-main/rev/872bee5fb2c3

Integrated Bruno's patch. Thanks a lot for your patch contribution Bruno!
Comment 12 Quality Engineering 2015-08-21 01:20:46 UTC
Integrated into 'main-silver', will be available in build *201508210002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/872bee5fb2c3
User: Jiri Kovalsky <jkovalsky@netbeans.org>
Log: #240826: Preventing java.lang.IllegalStateException thrown from Groovy when editing HTML files.
Comment 13 bruno.flavio 2015-08-23 19:35:26 UTC
Both the code snippet provided in the bug report and the bug verification procedure on comment 6 are now working. 

Tested with build 201508230002.
Comment 14 bruno.flavio 2016-02-08 23:43:49 UTC
*** Bug 244664 has been marked as a duplicate of this bug. ***
Comment 15 bruno.flavio 2016-02-08 23:50:33 UTC
*** Bug 246348 has been marked as a duplicate of this bug. ***