diff --git a/api.debugger.jpda/apichanges.xml b/api.debugger.jpda/apichanges.xml
--- a/api.debugger.jpda/apichanges.xml
+++ b/api.debugger.jpda/apichanges.xml
@@ -938,6 +938,24 @@
+
+
+
+ Differentiate application-level exceptions
+
+
+
+
+
+ InvalidExpressionException
can be thrown as a result
+ of an application-level exception. We need to differentiate this case
+ from exceptions thrown from NetBeans code. A boolean argument in the
+ constructor and a method hasApplicationTarget()
are
+ added to InvalidExpressionException
for this purpose.
+
+
+
+
diff --git a/api.debugger.jpda/manifest.mf b/api.debugger.jpda/manifest.mf
--- a/api.debugger.jpda/manifest.mf
+++ b/api.debugger.jpda/manifest.mf
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
-OpenIDE-Module-Specification-Version: 3.6
+OpenIDE-Module-Specification-Version: 3.7
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
diff --git a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/InvalidExpressionException.java b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/InvalidExpressionException.java
--- a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/InvalidExpressionException.java
+++ b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/InvalidExpressionException.java
@@ -53,6 +53,7 @@
public class InvalidExpressionException extends Exception {
private final String message;
+ private final boolean isFromApp;
/**
* Constructs a InvalidExpressionException with given message.
@@ -60,8 +61,7 @@
* @param message a exception message
*/
public InvalidExpressionException (String message) {
- super (message);
- this.message = message;
+ this(message, null);
}
/**
@@ -70,11 +70,23 @@
* @param t a target exception
*/
public InvalidExpressionException (Throwable t) {
- super (t);
- this.message = null;
+ this(null, t);
}
/**
+ * Constructs a InvalidExpressionException for a given target exception.
+ *
+ * @param t a target exception
+ * @param isFromApp true
when the target exception is a mirror
+ * of an application-level exception, false
+ * otherwise.
+ * @since 3.7
+ */
+ public InvalidExpressionException (Throwable t, boolean isFromApp) {
+ this(null, t, isFromApp);
+ }
+
+ /**
* Constructs a InvalidExpressionException with given message and target exception.
*
* @param message a exception message
@@ -82,8 +94,25 @@
* @since 3.1
*/
public InvalidExpressionException (String message, Throwable t) {
+ this(message, t, false);
+ }
+
+ /**
+ * Constructs a InvalidExpressionException with given message and target exception.
+ *
+ * @param message a exception message
+ * @param t a target exception
+ * @param isFromApp true
when the target exception is a mirror
+ * of an application-level exception, false
+ * otherwise.
+ * @since 3.7
+ */
+ public InvalidExpressionException (String message, Throwable t, boolean isFromApp) {
super(message, t);
+ // Assert that application-level exceptions have the appropriate mirror:
+ assert isFromApp && t != null || !isFromApp;
this.message = message;
+ this.isFromApp = isFromApp;
}
@Override
@@ -107,5 +136,15 @@
public Throwable getTargetException () {
return getCause();
}
+
+ /**
+ * Test whether the target exception is a mirror of an application-level
+ * exception.
+ * @return true
when the target exception represents an
+ * exception in the application code, false
otherwise.
+ */
+ public final boolean hasApplicationTarget() {
+ return isFromApp;
+ }
}
diff --git a/debugger.jpda.js/nbproject/project.xml b/debugger.jpda.js/nbproject/project.xml
--- a/debugger.jpda.js/nbproject/project.xml
+++ b/debugger.jpda.js/nbproject/project.xml
@@ -73,7 +73,7 @@
2
- 2.47
+ 3.7
diff --git a/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/DebuggerSupport.java b/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/DebuggerSupport.java
--- a/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/DebuggerSupport.java
+++ b/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/DebuggerSupport.java
@@ -226,7 +226,7 @@
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
name = targetException.getLocalizedMessage();
}
- throw new InvalidExpressionException(name, targetException);
+ throw new InvalidExpressionException(name, targetException, ieex.hasApplicationTarget());
}
}
diff --git a/debugger.jpda.ui/nbproject/project.xml b/debugger.jpda.ui/nbproject/project.xml
--- a/debugger.jpda.ui/nbproject/project.xml
+++ b/debugger.jpda.ui/nbproject/project.xml
@@ -64,7 +64,7 @@
2
- 2.42
+ 3.7
diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/JPDACodeEvaluator.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/JPDACodeEvaluator.java
--- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/JPDACodeEvaluator.java
+++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/JPDACodeEvaluator.java
@@ -199,7 +199,7 @@
} catch (InvalidExpressionException ieex) {
String message = ieex.getLocalizedMessage();
Throwable t = ieex.getTargetException();
- if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
+ if (t != null && ieex.hasApplicationTarget()) {
java.io.StringWriter s = new java.io.StringWriter();
java.io.PrintWriter p = new java.io.PrintWriter(s);
t.printStackTrace(p);
diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
--- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
+++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
@@ -562,7 +562,7 @@
m = NbBundle.getMessage(VariablesTableModel.class, "MSG_NA");
}
Throwable t = e.getTargetException();
- if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
+ if (t != null && e.hasApplicationTarget()) {
java.io.StringWriter s = new java.io.StringWriter();
java.io.PrintWriter p = new java.io.PrintWriter(s);
t.printStackTrace(p);
diff --git a/debugger.jpda/nbproject/project.xml b/debugger.jpda/nbproject/project.xml
--- a/debugger.jpda/nbproject/project.xml
+++ b/debugger.jpda/nbproject/project.xml
@@ -73,7 +73,7 @@
2
- 3.5
+ 3.7
diff --git a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
--- a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
+++ b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
@@ -2760,7 +2760,7 @@
throw new IllegalStateException(ieex);
} catch (InvocationException iex) {
Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw new IllegalStateException(ieex);
} finally {
try {
@@ -3797,7 +3797,7 @@
}
}
Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
} catch (UnsupportedOperationException uoex) {
InvalidExpressionException ieex = new InvalidExpressionException (uoex);
@@ -3874,7 +3874,7 @@
}
}
Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw new IllegalStateException(iex.getLocalizedMessage(), ieex);
} catch (UnsupportedOperationException uoex) {
InvalidExpressionException ieex = new InvalidExpressionException (uoex);
@@ -3977,7 +3977,7 @@
throw new IllegalStateException(ieex);
} catch (InvocationException iex) {
Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw new IllegalStateException(ieex);
} catch (UnsupportedOperationException uoex) {
InvalidExpressionException ieex = new InvalidExpressionException (uoex);
@@ -4061,7 +4061,7 @@
throw new IllegalStateException(ieex);
} catch (InvocationException iex) {
Throwable ex = new InvocationExceptionTranslated(iex, evaluationContext.getDebugger());
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw new IllegalStateException(ieex);
} catch (UnsupportedOperationException uoex) {
InvalidExpressionException ieex = new InvalidExpressionException (uoex);
diff --git a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/InvocationExceptionTranslated.java b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/InvocationExceptionTranslated.java
--- a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/InvocationExceptionTranslated.java
+++ b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/InvocationExceptionTranslated.java
@@ -77,14 +77,13 @@
import org.netbeans.modules.debugger.jpda.jdi.ValueWrapper;
import org.netbeans.modules.debugger.jpda.jdi.VirtualMachineWrapper;
import org.netbeans.modules.debugger.jpda.models.JPDAThreadImpl;
-import org.omg.CORBA.portable.ApplicationException;
import org.openide.util.Exceptions;
/**
*
* @author Martin
*/
-public class InvocationExceptionTranslated extends ApplicationException {
+public class InvocationExceptionTranslated extends Exception {
private static final Logger logger = Logger.getLogger(InvocationExceptionTranslated.class.getName());
diff --git a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
--- a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
+++ b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
@@ -372,7 +372,7 @@
ex.getStackTrace();
}
}
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
throw ieex;
} catch (UnsupportedOperationException uoex) {
InvalidExpressionException ieex = new InvalidExpressionException (uoex);
@@ -446,7 +446,7 @@
ex.getLocalizedMessage();
ex.getStackTrace();
}
- InvalidExpressionException ieex = new InvalidExpressionException (ex);
+ InvalidExpressionException ieex = new InvalidExpressionException (ex, true);
Exceptions.printStackTrace(ieex);
return null;
} catch (VMDisconnectedExceptionWrapper ex) {
diff --git a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/JPDAWatchImpl.java b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/JPDAWatchImpl.java
--- a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/JPDAWatchImpl.java
+++ b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/JPDAWatchImpl.java
@@ -119,7 +119,8 @@
if (exceptionDescription == null)
exceptionDescription = exception.getMessage ();
Throwable t = exception.getCause();
- if (t != null && t instanceof org.omg.CORBA.portable.ApplicationException) {
+ if (t != null && exception instanceof InvalidExpressionException &&
+ ((InvalidExpressionException) exception).hasApplicationTarget()) {
java.io.StringWriter s = new java.io.StringWriter();
java.io.PrintWriter p = new java.io.PrintWriter(s);
t.printStackTrace(p);