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 100007 - CCE in parser LanguagesManager
Summary: CCE in parser LanguagesManager
Status: RESOLVED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: languages (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jan Jancura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-04 16:12 UTC by Marek Fukala
Modified: 2007-04-10 16:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The CCE (1.32 KB, text/plain)
2007-04-04 16:14 UTC, Marek Fukala
Details
The NPE from ASTToken (1.28 KB, text/plain)
2007-04-05 08:16 UTC, Marek Fukala
Details
The NPE from Semantic (1.91 KB, application/octet-stream)
2007-04-05 08:16 UTC, Marek Fukala
Details
The rhtml file to reproduce (1.26 KB, text/plain)
2007-04-05 13:00 UTC, Marek Fukala
Details
The IllegalArgumentException (1.32 KB, text/plain)
2007-04-06 09:54 UTC, Marek Fukala
Details
The IAE from LanguagesManager (1.15 KB, text/plain)
2007-04-10 09:51 UTC, Marek Fukala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2007-04-04 16:12:36 UTC
To reproduce:
1) build netbeans according to 'how to get it' section on
http://wiki.netbeans.org/wiki/view/HTMLEmbeddedLanguagesHowTo
2) create an RHTML file with some ruby code <% ... %> or open an existing one
=> you will get following CCE:

SEVERE [org.openide.util.RequestProcessor]
java.lang.ClassCastException: org.netbeans.api.languages.ParseException
        at
org.netbeans.modules.languages.LanguagesManager.getLanguage(LanguagesManager.java:107)


The code on the line 107 is apparently incorrect, it assumes the instance is
always instance of Language class, which is not true - a few lines above an
instance of ParseException is put into.
Comment 1 Marek Fukala 2007-04-04 16:14:02 UTC
Created attachment 40445 [details]
The CCE
Comment 2 Marek Fukala 2007-04-05 08:15:12 UTC
The CCE shows up when I use scripting/ruby2 to parse the ruby content of the
rhtml. I tried to workaround the problem with creating an empty nbs file for
text/x-ruby mimetype and registered it instead of the one in ruby2 module, but
similar problems appeared again. The CCE appears again, but this time not for
text/x-ruby language, but for text/x-css, which indicates that the problem is
not related to the particullar language. Moreover a NPE from ASTItem.java:62
started to show up once the schliemann parser runs. Another NPE from
javascript's Semantic class shows as well. 

IMO these problems are related to your latest changes in fix of issue #99134 or
issue #99394 since they started to show up after I updated these two fixes from
trunk.

Please look at it ASAP, since I consider this as blockes for putting S. into
build. The last two exceptions (the NPEs) shows up also in JSP.
Comment 3 Marek Fukala 2007-04-05 08:16:09 UTC
Created attachment 40474 [details]
The NPE from ASTToken
Comment 4 Marek Fukala 2007-04-05 08:16:51 UTC
Created attachment 40475 [details]
The NPE from Semantic
Comment 5 Jan Jancura 2007-04-05 10:29:41 UTC
fixed in trunk:

IDE:-------------------------------------------------
IDE: [4/5/07 11:28 AM] Committing "Generic Languages Framework" started
Checking in src/org/netbeans/modules/languages/LanguagesManager.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/LanguagesManager.java,v
 <--  LanguagesManager.java
new revision: 1.17; previous revision: 1.16
done
Checking in src/org/netbeans/modules/languages/features/MySecondDrawLayer.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/features/MySecondDrawLayer.java,v
 <--  MySecondDrawLayer.java
new revision: 1.6; previous revision: 1.5
done
Checking in manifest.mf;
/cvs/languages/engine/manifest.mf,v  <--  manifest.mf
new revision: 1.68; previous revision: 1.67
done
IDE: [4/5/07 11:29 AM] Committing "Generic Languages Framework" finished
Comment 6 Marek Fukala 2007-04-05 13:00:00 UTC
Hanzi, you just fixed the CCE and replaced in by IllegalArgumentException. The
problem is still there. My point was that there is something worng much deeper,
the CCE was just so obvious... Have you tried to reproduce? Do you need my help? 

I am adding the .rb file which I use to reproduce. 
Comment 7 Marek Fukala 2007-04-05 13:00:54 UTC
Created attachment 40497 [details]
The rhtml file to reproduce
Comment 8 Jan Jancura 2007-04-05 20:51:10 UTC
Can you attach IAException stack trace,please?
Is it blocker for merge2trunk? (rhtml will not be in build)
I have no time to build whole ide + your modules today. So I have not tried it,
sorry.

Comment 9 Marek Fukala 2007-04-06 09:54:10 UTC
Created attachment 40539 [details]
The IllegalArgumentException
Comment 10 Marek Fukala 2007-04-06 10:08:53 UTC
I realized that the problem is caused by CSS piece embedded into the RHTML or
JSP.  The same problem appears in standalone CSS. Please try to build
languages/css and open a CSS file. It throws the IAE on my machine. Can you
please verify? Maybe it is something bad on my side!?!?
Comment 11 Jan Jancura 2007-04-06 21:08:31 UTC
I can not reproduce it in CSS.
Marek, can you doublecheck your sources, please? You must have some strange
version of files. I am not able to map your stack to my sources. Strange line
numbers...
Comment 12 Marek Fukala 2007-04-10 09:51:07 UTC
I am sorry, I have changed the source of Language class when trying to debug the
problem. The CVS doesn't work now so I cannot update the stack.

However I forgot to add the the exception which I was talking about - the IAE
from LanguagesManager. The LM is also modified so I cannot guarantee the lines,
but the IAE is thrown from the same place where the CCE was trown originally.
Comment 13 Marek Fukala 2007-04-10 09:51:52 UTC
Created attachment 40657 [details]
The IAE from LanguagesManager
Comment 14 Marek Fukala 2007-04-10 09:55:50 UTC
Just one more hint to reproduce: Sometimes, the schliemann parser doesn't take
into account CSS embedding for the first time (after the file is opened). Try to
rerun the parser by changing the document...
Comment 15 Jan Jancura 2007-04-10 13:00:14 UTC
I have tried to reproduce this bug in embedding_60 branch, but I was unsuccessful.
Embedding does not work for me at all!
Comment 16 Jan Jancura 2007-04-10 14:46:26 UTC
ths issue is really reproducible on embedding_60 branch only. Its caused by
l.getFeature () == null call. It should be changed to getFeatures () > 0.

I have added this check to trunk version too.


IDE:-------------------------------------------------
IDE: [4/10/07 3:42 PM] Committing "Generic Languages Framework" started
Checking in src/org/netbeans/modules/languages/LanguagesManager.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/LanguagesManager.java,v
 <--  LanguagesManager.java
new revision: 1.19; previous revision: 1.18
done
Checking in src/org/netbeans/modules/languages/ParserManagerImpl.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/ParserManagerImpl.java,v
 <--  ParserManagerImpl.java
new revision: 1.27; previous revision: 1.26
done
Checking in src/org/netbeans/modules/languages/Language.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/Language.java,v  <-- 
Language.java
new revision: 1.39; previous revision: 1.38
done
Checking in manifest.mf;
/cvs/languages/engine/manifest.mf,v  <--  manifest.mf
new revision: 1.73; previous revision: 1.72
done
IDE: [4/10/07 3:42 PM] Committing "Generic Languages Framework" finished

IDE:-------------------------------------------------
IDE: [4/10/07 3:43 PM] Committing "JavaScript.nbs" started
Checking in JavaScript.nbs;
/cvs/scripting/javascript/src/org/netbeans/modules/languages/javascript/JavaScript.nbs,v
 <--  JavaScript.nbs
new revision: 1.30; previous revision: 1.29
done
IDE: [4/10/07 3:43 PM] Committing "JavaScript.nbs" finished

IDE:-------------------------------------------------
IDE: [4/10/07 3:43 PM] Committing "manifest.mf" started
Checking in manifest.mf;
/cvs/scripting/javascript/manifest.mf,v  <--  manifest.mf
new revision: 1.29; previous revision: 1.28
done
IDE: [4/10/07 3:43 PM] Committing "manifest.mf" finished
Comment 17 Marek Fukala 2007-04-10 16:28:30 UTC
OK, the IAE is fixed now. The only problem which persisted is the NPE from
ASTItem.java:62 (I'll fill a separate issue for it).