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 195858 - NullPointerException at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.isWhiteSpaceToken
Summary: NullPointerException at org.netbeans.modules.css.formatting.api.support.Abstr...
Status: VERIFIED WORKSFORME
Alias: None
Product: web
Classification: Unclassified
Component: CSS Visual Tools (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on: 195855
Blocks:
  Show dependency tree
 
Reported: 2011-02-23 13:21 UTC by Vladimir Riha
Modified: 2011-06-08 10:00 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 176959


Attachments
stacktrace (3.59 KB, text/plain)
2011-02-23 13:21 UTC, Vladimir Riha
Details
stacktrace (4.75 KB, text/plain)
2011-02-23 13:36 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2011-02-23 13:21:39 UTC
Build: NetBeans IDE Dev (Build 201102230001)
VM: Java HotSpot(TM) Client VM, 21.0-b02, Java(TM) SE Runtime Environment, 1.7.0-ea-b130
OS: Windows XP

User Comments:
vriha: Info:
Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

What caused it: 
1. Create new php web  file
2. Hit enter after ?>




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.isWhiteSpaceToken(AbstractIndenter.java:1297)
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.findLanguageOffset(AbstractIndenter.java:1254)
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.doesLineStartWithOurLanguage(AbstractIndenter.java:1193)
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.processLanguage(AbstractIndenter.java:1044)
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.calculateIndentation(AbstractIndenter.java:322)
   at org.netbeans.modules.css.formatting.api.support.AbstractIndenter.reindent(AbstractIndenter.java:201)
Comment 1 Vladimir Riha 2011-02-23 13:21:43 UTC
Created attachment 106333 [details]
stacktrace
Comment 2 Vladimir Riha 2011-02-23 13:36:30 UTC
Created attachment 106335 [details]
stacktrace

What caused it:
1. Create new php web page
2. Right mouse click in the editor window and select Format

I reproduced it several times

Info:
Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 3 David Konecny 2011-02-24 22:37:07 UTC
I tried to reproduce on the same JDK 7 build but without success. I'm running on Ubuntu though. The error does not make much sense to me - token().text() must return null which is allowed according to its Javadoc but I wonder what triggers it. I would prefer to understand the cause then just blindly prevent the NPE. Keeping open for now and let's see whether more duplicate will be reported. For now marking as incomplete.
Comment 4 Marian Mirilovic 2011-02-25 12:01:12 UTC
Incomplete? Davide, common ... If you miss some information you can write which one and mark as incomplete, but it really doesn't fit into this situation. Vladimir can also run it with some logging if you want, as it looks like he is able to reproduce it (Lada are you able to reproduce it?)
Comment 5 David Konecny 2011-02-27 22:10:27 UTC
I miss how to reproduce it. I had a look at the code and tried all I could imagine to reproduce it but without any success. The change is in indentation code which has very good unit test coverage and this is first time I've seen this problem. Despite that the indentation code is abnormally complex and I do not want to change anything there unless I understand the cause. I could add some logging but right now my approach is to wait for more exception report duplicates to see that it really happens to more than one user. I wonder if JDK7 could be blamed for this.

Based on that I chose INCOMPLETE - I need more info on how to reproduce, if it happens on JDK6, how often it happens, etc. But it can be WORSFORME as well. :-)
Comment 6 Vladimir Riha 2011-02-28 09:33:06 UTC
A minute ago I reported it again, the log should be here shortly. Anyway, I noticed, that it happens probably only when issue #195855 occurs (at least for the last few attempts). So if I try to format php file, that is missing syntax highlighting, this error occurs.

Btw, I managed to reproduce it on
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
Comment 7 David Konecny 2011-03-01 01:12:55 UTC
(In reply to comment #6)
> I noticed, that it happens probably only when issue #195855 occurs

Some problem deep in editor lexing infrastructure would explain this issue. Let's wait for issue 195855 to get resolved and then see if this can be still reproduced.
Comment 8 Vladimir Riha 2011-06-08 10:00:20 UTC
Verified...

Product Version: NetBeans IDE 7.0.1 Dev (Build 201106072116)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b15