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.

View | Details | Raw Unified | Return to bug 268011
Collapse All | Expand All

(-)a/api.debugger.jpda/apichanges.xml (+18 lines)
Lines 938-943 Link Here
938
        <class package="org.netbeans.spi.debugger.jpda" name="SmartSteppingCallback" />
938
        <class package="org.netbeans.spi.debugger.jpda" name="SmartSteppingCallback" />
939
        <issue number="255918"/>
939
        <issue number="255918"/>
940
    </change>
940
    </change>
941
942
    <change>
943
        <api name="JPDADebuggerAPI"/>
944
        <summary>Differentiate application-level exceptions</summary>
945
        <version major="3" minor="7"/>
946
        <date day="28" month="9" year="2016"/>
947
        <author login="mentlicher"/>
948
        <compatibility addition="yes" source="compatible" binary="compatible"/>
949
        <description>
950
            <code>InvalidExpressionException</code> can be thrown as a result
951
            of an application-level exception. We need to differentiate this case
952
            from exceptions thrown from NetBeans code. A boolean argument in the
953
            constructor and a method <code>hasApplicationTarget()</code> are
954
            added to <code>InvalidExpressionException</code> for this purpose.
955
        </description>
956
        <class package="org.netbeans.api.debugger.jpda" name="InvalidExpressionException" />
957
        <issue number="268011"/>
958
    </change>
941
</changes>
959
</changes>
942
960
943
  <!-- Now the surrounding HTML text and document structure: -->
961
  <!-- Now the surrounding HTML text and document structure: -->
(-)a/api.debugger.jpda/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
2
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
4
OpenIDE-Module-Specification-Version: 3.6
4
OpenIDE-Module-Specification-Version: 3.7
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
6
6
(-)a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/InvalidExpressionException.java (-4 / +43 lines)
Lines 53-58 Link Here
53
public class InvalidExpressionException extends Exception {
53
public class InvalidExpressionException extends Exception {
54
54
55
    private final String message;
55
    private final String message;
56
    private final boolean isFromApp;
56
57
57
    /**
58
    /**
58
     * Constructs a InvalidExpressionException with given message.
59
     * Constructs a InvalidExpressionException with given message.
Lines 60-67 Link Here
60
     * @param message a exception message
61
     * @param message a exception message
61
     */
62
     */
62
    public InvalidExpressionException (String message) {
63
    public InvalidExpressionException (String message) {
63
        super (message);
64
        this(message, null);
64
        this.message = message;
65
    }
65
    }
66
66
67
    /**
67
    /**
Lines 70-80 Link Here
70
     * @param t a target exception
70
     * @param t a target exception
71
     */
71
     */
72
    public InvalidExpressionException (Throwable t) {
72
    public InvalidExpressionException (Throwable t) {
73
        super (t);
73
        this(null, t);
74
        this.message = null;
75
    }
74
    }
76
    
75
    
77
    /**
76
    /**
77
     * Constructs a InvalidExpressionException for a given target exception.
78
     *
79
     * @param t a target exception
80
     * @param isFromApp <code>true</code> when the target exception is a mirror
81
     *                  of an application-level exception, <code>false</code>
82
     *                  otherwise.
83
     * @since 3.7
84
     */
85
    public InvalidExpressionException (Throwable t, boolean isFromApp) {
86
        this(null, t, isFromApp);
87
    }
88
89
    /**
78
     * Constructs a InvalidExpressionException with given message and target exception.
90
     * Constructs a InvalidExpressionException with given message and target exception.
79
     *
91
     *
80
     * @param message a exception message
92
     * @param message a exception message
Lines 82-89 Link Here
82
     * @since 3.1
94
     * @since 3.1
83
     */
95
     */
84
    public InvalidExpressionException (String message, Throwable t) {
96
    public InvalidExpressionException (String message, Throwable t) {
97
        this(message, t, false);
98
    }
99
100
    /**
101
     * Constructs a InvalidExpressionException with given message and target exception.
102
     *
103
     * @param message a exception message
104
     * @param t a target exception
105
     * @param isFromApp <code>true</code> when the target exception is a mirror
106
     *                  of an application-level exception, <code>false</code>
107
     *                  otherwise.
108
     * @since 3.7
109
     */
110
    public InvalidExpressionException (String message, Throwable t, boolean isFromApp) {
85
        super(message, t);
111
        super(message, t);
112
        // Assert that application-level exceptions have the appropriate mirror:
113
        assert isFromApp && t != null || !isFromApp;
86
        this.message = message;
114
        this.message = message;
115
        this.isFromApp = isFromApp;
87
    }
116
    }
88
117
89
    @Override
118
    @Override
Lines 107-111 Link Here
107
    public Throwable getTargetException () {
136
    public Throwable getTargetException () {
108
        return getCause();
137
        return getCause();
109
    }
138
    }
139
    
140
    /**
141
     * Test whether the target exception is a mirror of an application-level
142
     * exception.
143
     * @return <code>true</code> when the target exception represents an
144
     *         exception in the application code, <code>false</code> otherwise.
145
     */
146
    public final boolean hasApplicationTarget() {
147
        return isFromApp;
148
    }
110
}
149
}
111
150
(-)a/debugger.jpda.js/nbproject/project.xml (-1 / +1 lines)
Lines 73-79 Link Here
73
                    <compile-dependency/>
73
                    <compile-dependency/>
74
                    <run-dependency>
74
                    <run-dependency>
75
                        <release-version>2</release-version>
75
                        <release-version>2</release-version>
76
                        <specification-version>2.47</specification-version>
76
                        <specification-version>3.7</specification-version>
77
                    </run-dependency>
77
                    </run-dependency>
78
                </dependency>
78
                </dependency>
79
                <dependency>
79
                <dependency>
(-)a/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/DebuggerSupport.java (-1 / +1 lines)
Lines 226-232 Link Here
226
            } catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
226
            } catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
227
                name = targetException.getLocalizedMessage();
227
                name = targetException.getLocalizedMessage();
228
            }
228
            }
229
            throw new InvalidExpressionException(name, targetException);
229
            throw new InvalidExpressionException(name, targetException, ieex.hasApplicationTarget());
230
        }
230
        }
231
    }
231
    }
232
    
232
    
(-)a/debugger.jpda.ui/nbproject/project.xml (-1 / +1 lines)
Lines 64-70 Link Here
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <release-version>2</release-version>
66
                        <release-version>2</release-version>
67
                        <specification-version>2.42</specification-version>
67
                        <specification-version>3.7</specification-version>
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/JPDACodeEvaluator.java (-1 / +1 lines)
Lines 199-205 Link Here
199
            } catch (InvalidExpressionException ieex) {
199
            } catch (InvalidExpressionException ieex) {
200
                String message = ieex.getLocalizedMessage();
200
                String message = ieex.getLocalizedMessage();
201
                Throwable t = ieex.getTargetException();
201
                Throwable t = ieex.getTargetException();
202
                if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
202
                if (t != null && ieex.hasApplicationTarget()) {
203
                    java.io.StringWriter s = new java.io.StringWriter();
203
                    java.io.StringWriter s = new java.io.StringWriter();
204
                    java.io.PrintWriter p = new java.io.PrintWriter(s);
204
                    java.io.PrintWriter p = new java.io.PrintWriter(s);
205
                    t.printStackTrace(p);
205
                    t.printStackTrace(p);
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java (-1 / +1 lines)
Lines 562-568 Link Here
562
            m = NbBundle.getMessage(VariablesTableModel.class, "MSG_NA");
562
            m = NbBundle.getMessage(VariablesTableModel.class, "MSG_NA");
563
        }
563
        }
564
        Throwable t = e.getTargetException();
564
        Throwable t = e.getTargetException();
565
        if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
565
        if (t != null && e.hasApplicationTarget()) {
566
            java.io.StringWriter s = new java.io.StringWriter();
566
            java.io.StringWriter s = new java.io.StringWriter();
567
            java.io.PrintWriter p = new java.io.PrintWriter(s);
567
            java.io.PrintWriter p = new java.io.PrintWriter(s);
568
            t.printStackTrace(p);
568
            t.printStackTrace(p);
(-)a/debugger.jpda/nbproject/project.xml (-1 / +1 lines)
Lines 73-79 Link Here
73
                    <compile-dependency/>
73
                    <compile-dependency/>
74
                    <run-dependency>
74
                    <run-dependency>
75
                        <release-version>2</release-version>
75
                        <release-version>2</release-version>
76
                        <specification-version>3.5</specification-version>
76
                        <specification-version>3.7</specification-version>
77
                    </run-dependency>
77
                    </run-dependency>
78
                </dependency>
78
                </dependency>
79
                <dependency>
79
                <dependency>
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java (-5 / +5 lines)
Lines 2760-2766 Link Here
2760
            throw new IllegalStateException(ieex);
2760
            throw new IllegalStateException(ieex);
2761
        } catch (InvocationException iex) {
2761
        } catch (InvocationException iex) {
2762
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
2762
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
2763
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
2763
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
2764
            throw new IllegalStateException(ieex);
2764
            throw new IllegalStateException(ieex);
2765
        } finally {
2765
        } finally {
2766
            try {
2766
            try {
Lines 3797-3803 Link Here
3797
                }
3797
                }
3798
            }
3798
            }
3799
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3799
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3800
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
3800
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
3801
            throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
3801
            throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
3802
        } catch (UnsupportedOperationException uoex) {
3802
        } catch (UnsupportedOperationException uoex) {
3803
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
3803
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
Lines 3874-3880 Link Here
3874
                }
3874
                }
3875
            }
3875
            }
3876
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3876
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3877
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
3877
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
3878
            throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
3878
            throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
3879
        } catch (UnsupportedOperationException uoex) {
3879
        } catch (UnsupportedOperationException uoex) {
3880
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
3880
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
Lines 3977-3983 Link Here
3977
            throw new IllegalStateException(ieex);
3977
            throw new IllegalStateException(ieex);
3978
        } catch (InvocationException iex) {
3978
        } catch (InvocationException iex) {
3979
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3979
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
3980
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
3980
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
3981
            throw new IllegalStateException(ieex);
3981
            throw new IllegalStateException(ieex);
3982
        } catch (UnsupportedOperationException uoex) {
3982
        } catch (UnsupportedOperationException uoex) {
3983
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
3983
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
Lines 4061-4067 Link Here
4061
            throw new IllegalStateException(ieex);
4061
            throw new IllegalStateException(ieex);
4062
        } catch (InvocationException iex) {
4062
        } catch (InvocationException iex) {
4063
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
4063
            Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
4064
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
4064
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
4065
            throw new IllegalStateException(ieex);
4065
            throw new IllegalStateException(ieex);
4066
        } catch (UnsupportedOperationException uoex) {
4066
        } catch (UnsupportedOperationException uoex) {
4067
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
4067
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/InvocationExceptionTranslated.java (-2 / +1 lines)
Lines 77-90 Link Here
77
import org.netbeans.modules.debugger.jpda.jdi.ValueWrapper;
77
import org.netbeans.modules.debugger.jpda.jdi.ValueWrapper;
78
import org.netbeans.modules.debugger.jpda.jdi.VirtualMachineWrapper;
78
import org.netbeans.modules.debugger.jpda.jdi.VirtualMachineWrapper;
79
import org.netbeans.modules.debugger.jpda.models.JPDAThreadImpl;
79
import org.netbeans.modules.debugger.jpda.models.JPDAThreadImpl;
80
import org.omg.CORBA.portable.ApplicationException;
81
import org.openide.util.Exceptions;
80
import org.openide.util.Exceptions;
82
81
83
/**
82
/**
84
 *
83
 *
85
 * @author Martin
84
 * @author Martin
86
 */
85
 */
87
public class InvocationExceptionTranslated extends ApplicationException {
86
public class InvocationExceptionTranslated extends Exception {
88
    
87
    
89
    private static final Logger logger = Logger.getLogger(InvocationExceptionTranslated.class.getName());
88
    private static final Logger logger = Logger.getLogger(InvocationExceptionTranslated.class.getName());
90
    
89
    
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java (-2 / +2 lines)
Lines 372-378 Link Here
372
                    ex.getStackTrace();
372
                    ex.getStackTrace();
373
                }
373
                }
374
            }
374
            }
375
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
375
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
376
            throw ieex;
376
            throw ieex;
377
        } catch (UnsupportedOperationException uoex) {
377
        } catch (UnsupportedOperationException uoex) {
378
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
378
            InvalidExpressionException ieex = new InvalidExpressionException (uoex);
Lines 446-452 Link Here
446
                ex.getLocalizedMessage();
446
                ex.getLocalizedMessage();
447
                ex.getStackTrace();
447
                ex.getStackTrace();
448
            }
448
            }
449
            InvalidExpressionException ieex = new InvalidExpressionException (ex);
449
            InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
450
            Exceptions.printStackTrace(ieex);
450
            Exceptions.printStackTrace(ieex);
451
            return null;
451
            return null;
452
        } catch (VMDisconnectedExceptionWrapper ex) {
452
        } catch (VMDisconnectedExceptionWrapper ex) {
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/JPDAWatchImpl.java (-1 / +2 lines)
Lines 119-125 Link Here
119
        if (exceptionDescription == null)
119
        if (exceptionDescription == null)
120
            exceptionDescription = exception.getMessage ();
120
            exceptionDescription = exception.getMessage ();
121
        Throwable t = exception.getCause();
121
        Throwable t = exception.getCause();
122
        if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
122
        if (t != null && exception instanceof InvalidExpressionException &&
123
            ((InvalidExpressionException) exception).hasApplicationTarget()) {
123
            java.io.StringWriter s = new java.io.StringWriter();
124
            java.io.StringWriter s = new java.io.StringWriter();
124
            java.io.PrintWriter p = new java.io.PrintWriter(s);
125
            java.io.PrintWriter p = new java.io.PrintWriter(s);
125
            t.printStackTrace(p);
126
            t.printStackTrace(p);

Return to bug 268011