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 262351 - NullPointerException at org.netbeans.modules.javascript2.editor.JsStructureScanner.foldsJson
Summary: NullPointerException at org.netbeans.modules.javascript2.editor.JsStructureSc...
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Features On Demand (show other bugs)
Version: 8.2
Hardware: All All
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-07 11:32 UTC by Jiri Skrivanek
Modified: 2017-02-12 19:03 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 224383


Attachments
stacktrace (2.83 KB, text/plain)
2016-06-07 11:32 UTC, Jiri Skrivanek
Details
stacktrace (2.83 KB, text/plain)
2016-07-13 13:36 UTC, Alexander Simon
Details
stacktrace (2.83 KB, text/plain)
2016-07-13 13:39 UTC, Alexander Simon
Details
stacktrace (2.83 KB, text/plain)
2016-07-13 13:42 UTC, Alexander Simon
Details
stacktrace (2.83 KB, text/plain)
2016-10-05 15:31 UTC, lhochet
Details
stacktrace (2.83 KB, text/plain)
2017-02-12 18:57 UTC, BartK
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2016-06-07 11:32:31 UTC
Build: NetBeans IDE Dev (Build javascript2-frameworks-1960-on-20160603)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.91-b14, Java(TM) SE Runtime Environment, 1.8.0_91-b14
OS: Windows 8.1

User Comments:
jskrivanek: I did:
- create new java project
- create new JSON file from template




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.javascript2.editor.JsStructureScanner.foldsJson(JsStructureScanner.java:351)
   at org.netbeans.modules.javascript2.editor.JsStructureScanner.folds(JsStructureScanner.java:296)
   at org.netbeans.modules.csl.editor.fold.GsfFoldManager$JavaElementFoldTask.scan(GsfFoldManager.java:528)
   at org.netbeans.modules.csl.editor.fold.GsfFoldManager$JavaElementFoldTask.access$100(GsfFoldManager.java:268)
   at org.netbeans.modules.csl.editor.fold.GsfFoldManager$JavaElementFoldTask$1.run(GsfFoldManager.java:434)
   at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:609)
Comment 1 Jiri Skrivanek 2016-06-07 11:32:33 UTC
Created attachment 159979 [details]
stacktrace
Comment 2 Petr Pisl 2016-06-07 14:44:01 UTC
In this case the javascript features are not enabled yet. The question is, whether the javascript and json templates should be available at this moment. 

I have find out that org.netbeans.lib.lexer.LanguageManager, creates in such case NO_LANG language and store it to the cache for the text/x-json mimetype. This no language is created before the javascript functionality is enabled and because the LanguageManger cache is not cleared, the no language is keep until you will restart the ide. After enabling the js features, the other languages are created correctly. 

If you create new javascript file before enabling js features, then json works correctly, but javascript editor does not work until restart. 

So IMHO the problem is that LanguageManager is asked for the text/x-json too early and it cannot find the right provider, so it creates NO_LANG, which stores to the cache, which is not refreshed, when the enabling features is done. 

The problem appears now, because I have moved javascript functionality from IDE cluster to the webcommon cluster. 

Svato, Milo: Any ideas?
Comment 3 Svata Dedic 2016-06-17 13:34:26 UTC
Apologies; wrong categorization.

While the situation could be possibly handled in Lexer API (lexer Mime provider does not listen on Language/LanguagesEmbeddingMap changes and does not refire events), I believe the proper place to fix the issue is ergonomics: the first Lookup for e.g. Language on a MimePath should be consistent with the subsequent ones - so the lookup for the Language should trigger loading of the appropriate cluster.

Jardo - please advise.
Comment 4 Alexander Simon 2016-07-13 13:36:54 UTC
Created attachment 160369 [details]
stacktrace

create json file
Comment 5 Alexander Simon 2016-07-13 13:39:55 UTC
Created attachment 160371 [details]
stacktrace

swith editor with empty json file
Comment 6 Alexander Simon 2016-07-13 13:42:54 UTC
Created attachment 160372 [details]
stacktrace

type char in empty json file
Comment 7 Exceptions Reporter 2016-07-13 13:42:58 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=224383
Comment 8 lhochet 2016-10-05 15:31:18 UTC
Created attachment 162351 [details]
stacktrace

opening an empty 'JSON' file
Comment 9 BartK 2017-02-12 18:57:23 UTC
Created attachment 163616 [details]
stacktrace

I was selecting a opened file form the dropdown at the top right of the editor panel
Comment 10 Exceptions Reporter 2017-02-12 19:00:25 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=224383
Comment 11 Exceptions Reporter 2017-02-12 19:03:25 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=224383