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 243981 - ClassCastException: java.lang.String cannot be cast to org.json.simple.JSONObject
Summary: ClassCastException: java.lang.String cannot be cast to org.json.simple.JSONOb...
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Inspection (show other bugs)
Version: 8.0.1
Hardware: All All
: P1 normal (vote)
Assignee: Jan Stola
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-22 06:05 UTC by Vladimir Riha
Modified: 2014-06-04 09:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 209196


Attachments
stacktrace (2.40 KB, text/plain)
2014-04-22 06:05 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-04-22 06:05:57 UTC
Build: NetBeans IDE Dev (Build 201404220001)
VM: Java HotSpot(TM) Client VM, 25.0-b70, Java(TM) SE Runtime Environment, 1.8.0-b132
OS: Linux

User Comments:
vriha: Ran HTML5 sample project Responsive Rabbits in embedded browser, turned on inspection mode, click on Welcome title




Stacktrace: 
java.lang.ClassCastException: java.lang.String cannot be cast to org.json.simple.JSONObject
   at org.netbeans.modules.web.webkit.debugging.api.css.Rule.<init>(Rule.java:125)
   at org.netbeans.modules.web.webkit.debugging.api.css.MatchedStyles.<init>(MatchedStyles.java:73)
   at org.netbeans.modules.web.webkit.debugging.api.css.CSS.getMatchedStyles(CSS.java:286)
   at org.netbeans.modules.web.inspect.webkit.ui.CSSStylesSelectionPanel.updateMatchedRules(CSSStylesSelectionPanel.java:644)
   at org.netbeans.modules.web.inspect.webkit.ui.CSSStylesSelectionPanel$9.run(CSSStylesSelectionPanel.java:633)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
Comment 1 Vladimir Riha 2014-04-22 06:05:59 UTC
Created attachment 146872 [details]
stacktrace
Comment 2 Jan Stola 2014-04-22 09:01:57 UTC
Thank you for catching this. It is a consequence of the fix of issue 241098. The exception shows that "selectorList" property is present in given CSS Rule, it has "selectors" sub-property but its type is array of Strings. Unfortunately, I have tested this on the latest version of Chrome (where the type of "selectors" is array of JSONObjects) and Embedded Browser from JDK 7 (where "selectorList" is not present). I overlooked that there is another version of the protocol (used by Embedded Browser in JDK 8).

For the sake of completeness, there are the mentioned changes in Chrome:
Introduction of "selectorList" (with an array of Strings):
http://src.chromium.org/viewvc/blink/trunk/Source/devtools/Inspector-1.1.json?r1=129469&r2=129470&
Replacement of the array of Strings by an array of Selectors (JSONObjects):
http://src.chromium.org/viewvc/blink/trunk/Source/devtools/protocol.json?r1=159732&r2=159733&
Comment 3 Jan Stola 2014-04-22 09:40:30 UTC
Fixed by http://hg.netbeans.org/web-main/rev/d45037796e43
Comment 4 Vladimir Riha 2014-06-04 09:30:24 UTC
Verified, thank you

Product Version: NetBeans IDE Dev (Build 201406040001)
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.13.0-27-generic running on i386; UTF-8; en_US (nb)
User directory: /home/vriha/.netbeans/dev
Cache directory: /home/vriha/.cache/netbeans/dev