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 250870 - java.lang.ClassCastException: org.python.antlr.PythonErrorNode cannot be cast to org.python.antlr.base.excepthandler
Summary: java.lang.ClassCastException: org.python.antlr.PythonErrorNode cannot be cast...
Status: RESOLVED FIXED
Alias: None
Product: python
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: Sun Solaris
: P3 normal (vote)
Assignee: Lou Dasaro
URL:
Keywords:
: 184218 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-03-03 14:13 UTC by whistler11783
Modified: 2015-12-13 15:00 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description whistler11783 2015-03-03 14:13:35 UTC
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: SunOS version 5.10 running on x86; ISO646-US; en (nb)

Same issue for same code in Windows 7 64-Bit as well.

I have the latest Python 8.0.2 Netbeans Plugin installed from the Netbeans Plugin Portal

I am getting a similar stacktrace to other bugs filed but they are not exact and no bugs have been filed for the new Python 8.0.2 plugin for Netbeans Version 8.0.2:

Annotation: Was parsing /workareas/main/work_server.py
Annotation: Was parsing /workareas/main/work_server.py
Was parsing /workareas/main/work_server.py
Was parsing /workareas/main/work_server.py
Caused: java.lang.ClassCastException: org.python.antlr.PythonErrorNode cannot be cast to org.python.antlr.base.excepthandler
	at org.python.antlr.ast.TryExcept.<init>(TryExcept.java:127)
	at org.python.antlr.GrammarActions.makeTryExcept(GrammarActions.java:224)
	at org.python.antlr.PythonParser.try_stmt(PythonParser.java:7257)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6325)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.if_stmt(PythonParser.java:6443)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6283)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.if_stmt(PythonParser.java:6443)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6283)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.if_stmt(PythonParser.java:6443)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6283)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.funcdef(PythonParser.java:1407)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6353)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.classdef(PythonParser.java:13427)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6367)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.file_input(PythonParser.java:630)
[catch] at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:303)
	at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:142)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:610)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:245)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:733)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 1 whistler11783 2015-03-03 14:21:26 UTC
My experience with this plugin so far is that once this issue occurs the limited code completion that is available completely stops working. Also, the syntax highlighting becomes quite inconsistent and wonky.
Comment 2 juniel_katarn 2015-03-18 08:57:37 UTC
Greetings. Please note Python support is currently a work in progress and we are working to bring it to both feature completion and stability.

Can you please provide concrete steps to reproduce, so we can fix this issue?

Thanks.
Comment 3 whistler11783 2015-04-09 19:50:48 UTC
This code reproduces the issue with the same general outcome.

#! /usr/bin/env python

def test_func(p1, p2, p3):
    return p1 * p2 * p3

if __name__ == '__main__':
    try:
        val = test_func(1, 2, 3)
    except Exception as e:
        print 'oops'
Comment 4 whistler11783 2015-04-09 19:53:20 UTC
(In reply to whistler11783 from comment #3)
> This code reproduces the issue with the same general outcome.
> 
> #! /usr/bin/env python
> 
> def test_func(p1, p2, p3):
>     return p1 * p2 * p3
> 
> if __name__ == '__main__':
>     try:
>         val = test_func(1, 2, 3)
>     except Exception as e:
>         print 'oops'

In addition, this code causes the object navigator to become unpopulated due to the thrown exception.
Comment 5 whistler11783 2015-04-09 20:04:07 UTC
(In reply to whistler11783 from comment #4)
> (In reply to whistler11783 from comment #3)
> > This code reproduces the issue with the same general outcome.
> > 
> > #! /usr/bin/env python
> > 
> > def test_func(p1, p2, p3):
> >     return p1 * p2 * p3
> > 
> > if __name__ == '__main__':
> >     try:
> >         val = test_func(1, 2, 3)
> >     except Exception as e:
> >         print 'oops'
> 
> In addition, this code causes the object navigator to become unpopulated due
> to the thrown exception.

This code causes this stack trace:
Annotation: Was parsing /workareas/main/work_server.py
Annotation: Was parsing /workareas/main/work_server.py
Was parsing /workareas/main/work_server.py
Was parsing /workareas/main/work_server.py
Caused: java.lang.ClassCastException: org.python.antlr.PythonErrorNode cannot be cast to org.python.antlr.base.excepthandler
	at org.python.antlr.ast.TryExcept.<init>(TryExcept.java:127)
	at org.python.antlr.GrammarActions.makeTryExcept(GrammarActions.java:224)
	at org.python.antlr.PythonParser.try_stmt(PythonParser.java:7257)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6325)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.suite(PythonParser.java:7761)
	at org.python.antlr.PythonParser.if_stmt(PythonParser.java:6443)
	at org.python.antlr.PythonParser.compound_stmt(PythonParser.java:6283)
	at org.python.antlr.PythonParser.stmt(PythonParser.java:2401)
	at org.python.antlr.PythonParser.file_input(PythonParser.java:630)
[catch] at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:303)
	at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:142)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:610)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:245)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:733)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 6 Lou Dasaro 2015-04-10 05:24:48 UTC
*** Bug 184218 has been marked as a duplicate of this bug. ***
Comment 7 Lou Dasaro 2015-05-25 02:53:29 UTC
Likely fixed as a result of the GSF-to-CSL conversion, 
I am unable to replicate the error using your test case and NetBeans IDE Dev 201505170001, on a Windows 8.1 box. Therefore marking as Fixed.

Reporter: Please try with the latest development build of Netbeans and let us know what you find! Reopen if necessary...
Comment 8 wolter 2015-12-10 15:25:01 UTC
This parsing error affect:

#pass example

try:
  pass
except Exception:
  pass

#fail example

try:
  pass
except Exception as e:
  pass
Comment 9 Lou Dasaro 2015-12-10 17:55:06 UTC
Reporter: Please copy the information from Help->About and paste it here like you did in your initial report. Note: We are not making any fixes to 8.0.2; only 8.1 is supported at this time.
Thank you.
Comment 10 Jenselme 2015-12-13 15:00:24 UTC
Hi,

I cannot reproduce with 8.1. Marking the bug as fixed. If you still experience this bug with 8.1, please reopen.