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 206100

Summary: [71cat] UnsupportedOperationException: Not supported element kind:RESOURCE_VARIABLE Tree = 'session'
Product: debugger Reporter: _ gtzabari <gtzabari>
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: VERIFIED FIXED    
Severity: normal CC: Cheloveche, lhochet, mmirilovic
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 183532
Attachments: stacktrace

Description _ gtzabari 2011-12-07 16:45:25 UTC
This bug was originally marked as duplicate of bug 157191, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.1 RC2 (Build 201111302200)
VM: Java HotSpot(TM) Client VM, 21.1-b02, Java(TM) SE Runtime Environment, 1.7.0_01-b08
OS: Windows 7

User Comments:
gtzabari: Placed caret on top of "session" variable for evaluation. Exception thrown.




Stacktrace: 
java.lang.UnsupportedOperationException: Not supported element kind:RESOURCE_VARIABLE Tree = 'session'
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitIdentifier(EvaluatorVisitor.java:1985)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitIdentifier(EvaluatorVisitor.java:194)
   at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1716)
   at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:49)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.scan(EvaluatorVisitor.java:232)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.scan(EvaluatorVisitor.java:194)
Comment 1 _ gtzabari 2011-12-07 16:45:29 UTC
Created attachment 113932 [details]
stacktrace
Comment 2 Martin Entlicher 2011-12-08 10:17:57 UTC
Reproduced with a small program:

    public static void main(String[] args) {
        System.out.println("Hello World.");
        try (DataOutputStream os = new DataOutputStream(new FileOutputStream("/tmp/xTestHello.hello"));) {
            os.writeChars("Hello World!\n");
        } catch (EOFException e) {
        } catch (IOException ioex) {
            System.err.println(ioex);
        }
    }

When trying to evaluate "os" in debugger, it throws this exception.
Comment 3 Martin Entlicher 2011-12-08 13:28:29 UTC
It's fixed by changeset:   208605:d7a5471edf3f
http://hg.netbeans.org/main/rev/d7a5471edf3f

I'm making this a candidate for 7.1 patch.
Comment 4 Martin Entlicher 2011-12-08 13:31:29 UTC
Oops, the last comment was intended for issue #206096, please ignore.

This is fixed by changeset:   208606:e586a7ee25ad
http://hg.netbeans.org/main/rev/e586a7ee25ad
Comment 5 Quality Engineering 2011-12-09 12:10:49 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/e586a7ee25ad
User: mentlicher@netbeans.org
Log: #206100 Handle resource variables.
Comment 6 Jiri Kovalsky 2012-01-18 12:13:07 UTC
If I get it right, this issue is erroneously marked as candidate for 7.1.1. Correct?
Comment 7 Martin Entlicher 2012-01-19 14:17:55 UTC
Well, it was marked as candidate for 7.1.1 by a mistake, but I've decided to leave it there, since the patch is very simple and very unlikely to do any harm. And users trying to use the new language features can easily run into this bug.
Comment 8 Jiri Kovalsky 2012-01-20 10:32:07 UTC
I see. The problem is that I was not able to reproduce this exception even in 7.1. I toggled line breakpoint as indicated below, started debugging and invoked "Debug > Evaluate Expression...". Typed "os" and pushed "Evaluate code fragment" button. New "os" variable was created in "Variables" tab and no exception was thrown.

public static void main(String[] args) {
    System.out.println("Hello World.");
    try {
        DataOutputStream os = new DataOutputStream(new FileOutputStream("/tmp/xTestHello.hello"));
        os.writeChars("Hello World!\n"); // Toggle line breakpoint here
    } catch (EOFException e) {
    } catch (IOException ioex) {
        System.err.println(ioex);
    }
}

Any exact steps to reproduce?
Comment 9 Jiri Kovalsky 2012-01-20 10:45:22 UTC
Oh, sorry. This is JDK 7 specific issue. Reproduced in NetBeans 7.1 with JDK 7 and the original code fragment and verified as fixed in development build #201201170601 of NetBeans 7.2.
Comment 10 Martin Entlicher 2012-01-31 14:31:11 UTC
Fix transplanted to release71_fixes branch: changeset: 218584:7e87846ed376
http://hg.netbeans.org/releases/rev/7e87846ed376

Increased specification version by changeset:   218587:50816e61e6b9
http://hg.netbeans.org/releases/rev/50816e61e6b9
Comment 11 Jiri Kovalsky 2012-02-27 13:43:17 UTC
The bug is fixed in NetBeans IDE 7.1.1 build #201202262200.