[prev in list] [next in list] [prev in thread] [next in thread]
List: e-lang
Subject: Re: [e-lang] Embed E in Java
From: Kevin Reid <kpreid () mac ! com>
Date: 2010-01-13 2:55:46
Message-ID: EDF31680-1FCF-4732-98C3-66BDA90E36B1 () mac ! com
[Download RAW message or body]
On Oct 21, 2009, at 13:25, Mark Miller wrote:
> On Tue, Oct 20, 2009 at 9:17 AM, Kevin Reid <kpreid@mac.com> wrote:
>> MarkM: Is there a non-historical reason NestedException/
>> NestedThrowable/etc exist instead of using the Java 1.4
>> Throwable.getCause() mechanism?
>
> Mostly history. The NestedException,.. mechanism predates Java 1.4.
> Since it worked, I have never examined the new getCause() API. I do
> not know whether or not it would be safe to use instead.
[rest of thread omitted]
Here's my draft patch for this. Please review.
It makes the following changes:
* NestedException and NestedIOException now use the Throwable cause
field to store the provided exception. (The constructor parameter
order is backwards from the Java conventional one, but I decided not
to make the effort to change that.)
* Deleted NestedError, as that class was not used.
* Renamed Nested* to EBacktrace*, reflecting the primary use of these
classes since 'nesting' is now in general possible with plain Java
throwables. (I'm not sure this is a good idea.)
* Enabled getCause() and initCause(throwable) in Throwable.safej. (I
also noticed that printStackTrace() is enabled, but should not be, as
it carries authority to stderr; I intend to fix this as a separate
commit.)
["nested-exception-renamed-and-uses-cause-20090112.patch" (nested-exception-renamed-and-uses-cause-20090112.patch)]
Index: safej/java/lang/Throwable.safej
===================================================================
--- safej/java/lang/Throwable.safej (revision 721)
+++ safej/java/lang/Throwable.safej (working copy)
@@ -9,9 +9,11 @@
statics(method("run()"),
method("run(String)")),
methods(method("fillInStackTrace()"),
+ method("getCause()"),
method("getLocalizedMessage()"),
method("getMessage()"),
method("getStackTrace()"),
+ method("initCause(Throwable)"),
method("printStackTrace()"),
method("printStackTrace(PrintStream)"),
method("printStackTrace(PrintWriter)")))
Index: esrc/scripts/test/updoc/nested-throwable.updoc
===================================================================
--- esrc/scripts/test/updoc/nested-throwable.updoc (revision 0)
+++ esrc/scripts/test/updoc/nested-throwable.updoc (revision 0)
@@ -0,0 +1,247 @@
+# Copyright 2010 Kevin Reid, under the terms of the MIT X license
+# found at http://www.opensource.org/licenses/mit-license.html ................
+
+As of r721 (2010-01-12), E-on-Java has a mechanism for wrapping throwables with \
other throwables (the NestedThrowable interface, and classes implementing), invented \
before java.lang.Throwable gained the 'cause' facility (Java 1.4). These two are now \
being integrated. Additionally, Nested* have been renamed to EBacktrace* to reflect \
their sole purpose now that the "nesting" concept is in core Java. This file contains \
tests written to confirm that no external/programmer-visible behavior has not changed \
as a result of this, and that the cause-related methods are usable from E. +
+
+We're going to be looking at stack traces, so this print-func alteration avoids \
showing changes to pathnames. +
+ ? def makeTextWriter := <elib:oldeio.makeTextWriter>
+ > interp.setPrintFunc({
+ > def oldPrint := interp.getPrintFunc()
+ > def newPrint(value, out) {
+ > def [tw, sb] := makeTextWriter.makeBufferingPair()
+ > oldPrint(value, tw)
+ > var string := sb.snapshot()
+ > # XXX messy, E needs a proper regexp-substitute operation
+ > while (string =~ \
rx`(?s)(@left.*?)<file:(?:[^>]*?)/(@fname[^>/#]*)#(?:[a-z:0-9]+?)>(@right.*)`) { + > \
string := `$left<file:.../$fname#...>$right` + > }
+ > while (string =~ rx`(?s)(@left.*?)\((@fname[\w$$]+.java):\d+\)(@right.*)`) {
+ > string := `$left($fname:...)$right`
+ > }
+ > while (string =~ rx`(?s)(@left.*?)GeneratedMethodAccessor\d+(@right.*)`) {
+ > string := `${left}GeneratedMethodAccessor...$right`
+ > }
+ > out.print(string)
+ > }
+ > })
+
+An exception value to test with.
+
+ ? def anEInterpException := try {
+ > throw("bang")
+ > } catch e {
+ > e
+ > }
+ # value: problem: bang
+
+ ? anEInterpException.__getAllegedType()
+ # value: EBacktraceException
+
+ ? anEInterpException.getMessage()
+ # value: "@ run/1: <file:.../nested-throwable.updoc#...>"
+
+(Yes, these values will need revision as the E interp and other things change. \
Sorry!) +
+ ? anEInterpException.eStack()
+ # value: "
+ # - Thrower#run(RuntimeException)
+ # . throw(\"bang\")
+ # @ run/1: <file:.../nested-throwable.updoc#...>"
+
+ ? anEInterpException.javaStack()
+ # value: "java.lang.RuntimeException: bang
+ # \tat org.erights.e.meta.java.lang.ThrowableGuardSugar.subCoerceR(ThrowableGuardSugar.java:...)
+ # \tat org.erights.e.elib.base.ClassDesc.tryCoerceR(ClassDesc.java:...)
+ # \tat org.erights.e.elib.slot.BaseAuditor.coerce(BaseAuditor.java:...)
+ # \tat org.erights.e.elib.prim.E.as(E.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.coerceArgs(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...)
+ # \tat org.erights.e.elang.evm.EExpr.eval(EExpr.java:...)
+ # \tat org.erights.e.elang.evm.EExpr.evalToPair(EExpr.java:...)
+ # \tat sun.reflect.GeneratedMethodAccessor....invoke(Unknown Source)
+ # \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:...)
+ # \tat java.lang.reflect.Method.invoke(Method.java:...)
+ # \tat org.erights.e.elib.prim.InstanceMethodNode.innerExecute(InstanceMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.FinallyExpr.subEval(FinallyExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EscapeExpr.subEval(EscapeExpr.java:...)
+ # \tat org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...)
+ # \tat org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.E.callAll(E.java:...)
+ # \tat org.erights.e.elib.vat.PendingDelivery.innerRun(PendingDelivery.java:...)
+ # \tat org.erights.e.elib.vat.PendingEvent.run(PendingEvent.java:...)
+ # \tat org.erights.e.elib.vat.HeadlessRunner.run(HeadlessRunner.java:...)
+ # \tat java.lang.Thread.run(Thread.java:...)
+ # "
+
+ ? anEInterpException.unwrap().__getAllegedType()
+ # value: EBacktraceException
+
+ ? anEInterpException.unwrap().getMessage()
+ # value: ". throw(\"bang\")"
+
+ ? anEInterpException.leaf().__getAllegedType()
+ # value: RuntimeException
+
+ ? anEInterpException.leaf().getMessage()
+ # value: "bang"
+
+Note that unwrap() is superseded by getCause(), but leaf()'s functionality is \
unique. Furthermore, on consideration I (Kevin Reid) decided that (XXX review if this \
is still true) leaf() should not unwrap more things than it used to; therefore it \
still has the explicit unwrapping functionality. +
+OK, now that that's been established, on to testing existing things which (before \
the transition) mentioned Nested*, unwrap(), or leaf(). +
+com.skyhunter.e.util.stackTraceFunc
+
+ ? def stackTraceFunc := <import:com.skyhunter.e.util.stackTraceFunc>
+ > stackTraceFunc(anEInterpException)
+ # value: "
+ # - Thrower#run(RuntimeException)
+ # . throw(\"bang\")
+ # @ run/1: <file:.../nested-throwable.updoc#...>
+ #
+ # java.lang.RuntimeException: bang
+ # \tat org.erights.e.meta.java.lang.ThrowableGuardSugar.subCoerceR(ThrowableGuardSugar.java:...)
+ # \tat org.erights.e.elib.base.ClassDesc.tryCoerceR(ClassDesc.java:...)
+ # \tat org.erights.e.elib.slot.BaseAuditor.coerce(BaseAuditor.java:...)
+ # \tat org.erights.e.elib.prim.E.as(E.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.coerceArgs(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...)
+ # \tat org.erights.e.elang.evm.EExpr.eval(EExpr.java:...)
+ # \tat org.erights.e.elang.evm.EExpr.evalToPair(EExpr.java:...)
+ # \tat sun.reflect.GeneratedMethodAccessor....invoke(Unknown Source)
+ # \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:...)
+ # \tat java.lang.reflect.Method.invoke(Method.java:...)
+ # \tat org.erights.e.elib.prim.InstanceMethodNode.innerExecute(InstanceMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.FinallyExpr.subEval(FinallyExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...)
+ # \tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EscapeExpr.subEval(EscapeExpr.java:...)
+ # \tat org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...)
+ # \tat org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...)
+ # \tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...)
+ # \tat org.erights.e.elang.evm.EMethod.execute(EMethod.java:...)
+ # \tat org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...)
+ # \tat org.erights.e.elib.prim.E.callAll(E.java:...)
+ # \tat org.erights.e.elib.vat.PendingDelivery.innerRun(PendingDelivery.java:...)
+ # \tat org.erights.e.elib.vat.PendingEvent.run(PendingEvent.java:...)
+ # \tat org.erights.e.elib.vat.HeadlessRunner.run(HeadlessRunner.java:...)
+ # \tat java.lang.Thread.run(Thread.java:...)
+ # "
+
+org.erights.e.elang.cmd.makeAnswerer
+
+ ? def makeAnswerer := <import:org.erights.e.elang.cmd.makeAnswerer>
+ > def [tw, sb] := makeTextWriter.makeBufferingPair()
+ > def answerer := makeAnswerer(tw)
+ > answerer.reportProblem(anEInterpException, true, true)
+ > sb.snapshot()
+ # value: "# problem: bang
+ # #
+ # # java.lang.RuntimeException: bang
+ # # \tat \
org.erights.e.meta.java.lang.ThrowableGuardSugar.subCoerceR(ThrowableGuardSugar.java:...)
+ # # \tat \
org.erights.e.elib.base.ClassDesc.tryCoerceR(ClassDesc.java:...) + # # \
\tat org.erights.e.elib.slot.BaseAuditor.coerce(BaseAuditor.java:...) + # # \
\tat org.erights.e.elib.prim.E.as(E.java:...) + # # \tat \
org.erights.e.elib.prim.JavaMemberNode.coerceArgs(JavaMemberNode.java:...) + # \
# \tat org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...) + # \
# \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...) + # # \
\tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...) + # # \
\tat org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...) + # # \
\tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...) + # # \
\tat org.erights.e.elang.evm.EExpr.eval(EExpr.java:...) + # # \tat \
org.erights.e.elang.evm.EExpr.evalToPair(EExpr.java:...) + # # \tat \
sun.reflect.GeneratedMethodAccessor....invoke(Unknown Source) + # # \tat \
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:...)
+ # # \tat java.lang.reflect.Method.invoke(Method.java:...)
+ # # \tat \
org.erights.e.elib.prim.InstanceMethodNode.innerExecute(InstanceMethodNode.java:...) \
+ # # \tat \
org.erights.e.elib.prim.JavaMemberNode.execute(JavaMemberNode.java:...) + # \
# \tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...) + # # \
\tat org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...) + # # \
\tat org.erights.e.elang.evm.DefineExpr.subEval(DefineExpr.java:...) + # # \
\tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...) + # # \tat \
org.erights.e.elang.evm.FinallyExpr.subEval(FinallyExpr.java:...) + # # \
\tat org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.EMethod.execute(EMethod.java:...) + # # \tat \
org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...) + # # \
\tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...) + # # \tat \
org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...) + # # \tat \
org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.EMethod.execute(EMethod.java:...) + # # \tat \
org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...) + # # \
\tat org.erights.e.elib.prim.Selector.callIt(Selector.java:...) + # # \tat \
org.erights.e.elang.evm.CallExpr.subEval(CallExpr.java:...) + # # \tat \
org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.CatchExpr.subEval(CatchExpr.java:...) + # # \tat \
org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.EscapeExpr.subEval(EscapeExpr.java:...) + # # \tat \
org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...) + # # \tat \
org.erights.e.elang.evm.IfExpr.subEval(IfExpr.java:...) + # # \tat \
org.erights.e.elang.evm.SeqExpr.subEval(SeqExpr.java:...) + # # \tat \
org.erights.e.elang.evm.EMethod.execute(EMethod.java:...) + # # \tat \
org.erights.e.elang.evm.EMethodNode.execute(EMethodNode.java:...) + # # \
\tat org.erights.e.elib.prim.E.callAll(E.java:...) + # # \tat \
org.erights.e.elib.vat.PendingDelivery.innerRun(PendingDelivery.java:...) + # \
# \tat org.erights.e.elib.vat.PendingEvent.run(PendingEvent.java:...) + # \
# \tat org.erights.e.elib.vat.HeadlessRunner.run(HeadlessRunner.java:...) + # \
# \tat java.lang.Thread.run(Thread.java:...) + # #
+ # # - Thrower#run(RuntimeException)
+ # # . throw(\"bang\")
+ # # @ run/1: <file:.../nested-throwable.updoc#...>
+ #
+ # "
+
+
+eBrowser.* problemReporterMaker matches SyntaxExceptions: can't test this in updoc \
because it's intertwined in GUI code. The effect should be to jump to the location of \
a syntax error. +
+parseAndPlay in updoc.e matches SyntaxExceptions: the effect should be that syntax \
exceptions there don't show backtraces. +
Property changes on: esrc/scripts/test/updoc/nested-throwable.updoc
___________________________________________________________________
Added: svn:eol-style
+ native
Index: jsrc/net/captp/jcomm/CapTPConnection.java
===================================================================
--- jsrc/net/captp/jcomm/CapTPConnection.java (revision 721)
+++ jsrc/net/captp/jcomm/CapTPConnection.java (working copy)
@@ -33,7 +33,7 @@
import net.vattp.security.ESecureRandom;
import org.erights.e.develop.assertion.T;
import org.erights.e.develop.exception.ExceptionMgr;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.trace.Trace;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.ref.DelayedRedirector;
@@ -1184,7 +1184,7 @@
public void connectionDead(VatTPConnection dataConn, Throwable problem) {
T.require(dataConn == myDataConnection,
"dead VatTPConnection doesn't match");
- killConnection(new NestedException(problem, "# lost " + dataConn),
+ killConnection(new EBacktraceException(problem, "# lost " + dataConn),
myShuttingDownFlag);
}
Index: jsrc/net/vattp/security/MicroTime.java
===================================================================
--- jsrc/net/vattp/security/MicroTime.java (revision 721)
+++ jsrc/net/vattp/security/MicroTime.java (working copy)
@@ -19,7 +19,7 @@
Contributor(s): ______________________________________.
*/
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.prim.StaticMaker;
import org.erights.e.elib.util.ClassCache;
@@ -48,7 +48,7 @@
//PrintStreamWriter.err().println("not using native timers: " +
// ule);
} catch (ClassNotFoundException cnf) {
- throw new NestedException(cnf, "# no Native");
+ throw new EBacktraceException(cnf, "# no Native");
}
initializeTimer();
}
Index: jsrc/net/vattp/data/Encrypt3DES.java
===================================================================
--- jsrc/net/vattp/data/Encrypt3DES.java (revision 721)
+++ jsrc/net/vattp/data/Encrypt3DES.java (working copy)
@@ -22,7 +22,7 @@
import net.vattp.security.MicroTime;
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.trace.Trace;
import java.security.InvalidKeyException;
@@ -64,7 +64,7 @@
myDes3.initEncrypt(key);
} catch (InvalidKeyException ike) {
Trace.comm.errorm("Problem initializing DES keys", ike);
- throw new NestedException(ike, "# Problem initializing DES keys");
+ throw new EBacktraceException(ike, "# Problem initializing DES keys");
}
System.arraycopy(myIV, 0, myPreviousBlock, 0, 8);
}
Index: jsrc/net/vattp/data/SendThread.java
===================================================================
--- jsrc/net/vattp/data/SendThread.java (revision 721)
+++ jsrc/net/vattp/data/SendThread.java (working copy)
@@ -25,7 +25,7 @@
import net.vattp.security.MicroTime;
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedIOException;
+import org.erights.e.develop.exception.EBacktraceIOException;
import org.erights.e.develop.trace.Trace;
import org.erights.e.elib.util.HexStringUtils;
import org.erights.e.elib.vat.SynchQueue;
@@ -573,7 +573,7 @@
myAddressesTried.put(remoteInetAddress, remoteInetAddress);
throw he;
} catch (BindException be) {
- throw new NestedIOException(be,
+ throw new EBacktraceIOException(be,
"BindException binding to " +
remoteNetAddr);
}
Index: jsrc/net/vattp/data/Decrypt3DES.java
===================================================================
--- jsrc/net/vattp/data/Decrypt3DES.java (revision 721)
+++ jsrc/net/vattp/data/Decrypt3DES.java (working copy)
@@ -22,7 +22,7 @@
import net.vattp.security.MicroTime;
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.trace.Trace;
import java.security.InvalidKeyException;
@@ -64,7 +64,7 @@
myDes3.initDecrypt(key);
} catch (InvalidKeyException ike) {
Trace.comm.errorm("Problem initializing DES keys", ike);
- throw new NestedException(ike, "# Problem initializing DES keys");
+ throw new EBacktraceException(ike, "# Problem initializing DES keys");
}
}
Index: jsrc/org/quasiliteral/html/SafeHTMLParser.java
===================================================================
--- jsrc/org/quasiliteral/html/SafeHTMLParser.java (revision 721)
+++ jsrc/org/quasiliteral/html/SafeHTMLParser.java (working copy)
@@ -2,7 +2,7 @@
import org.erights.e.develop.assertion.T;
import org.erights.e.develop.exception.ExceptionMgr;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.format.StringHelper;
import org.erights.e.elib.base.ValueThunk;
import org.erights.e.elib.tables.ConstMap;
@@ -10,7 +10,6 @@
import org.erights.e.elib.tables.FlexMap;
import org.erights.e.elib.tables.FlexSet;
-import javax.swing.JEditorPane;
import javax.swing.text.ChangedCharSetException;
import javax.swing.text.html.parser.AttributeList;
import javax.swing.text.html.parser.DTD;
@@ -107,7 +106,7 @@
try {
make(text).parse(new StringReader(text));
} catch (Throwable th) {
- throw new NestedException(th, "# unsafe html: " + text);
+ throw new EBacktraceException(th, "# unsafe html: " + text);
}
}
Index: jsrc/org/quasiliteral/text/EYaccFixer.java
===================================================================
--- jsrc/org/quasiliteral/text/EYaccFixer.java (revision 721)
+++ jsrc/org/quasiliteral/text/EYaccFixer.java (working copy)
@@ -71,7 +71,7 @@
" T.fail(rName + \" bad checkhash: \" +\n" +
" hash);\n" + " }\n" +
" } catch (Exception ex) {\n" +
- " throw new NestedException(ex, \"# initing parser\");\n" +
+ " throw new EBacktraceException(ex, \"# initing parser\");\n" +
" }\n" + "}\n\n" + "${3}int yyparse() ${4}"));
}
Index: jsrc/org/quasiliteral/term/GrammarParser.java
===================================================================
--- jsrc/org/quasiliteral/term/GrammarParser.java (revision 721)
+++ jsrc/org/quasiliteral/term/GrammarParser.java (working copy)
@@ -11,7 +11,7 @@
//#line 16 "grammar.y"
package org.quasiliteral.term;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.erights.e.meta.java.lang.CharacterMakerSugar;
@@ -448,7 +448,7 @@
GrammarParser parser = new GrammarParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/quasiliteral/term/grammar.y
===================================================================
--- jsrc/org/quasiliteral/term/grammar.y (revision 721)
+++ jsrc/org/quasiliteral/term/grammar.y (working copy)
@@ -15,7 +15,7 @@
%{
package org.quasiliteral.term;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.erights.e.meta.java.lang.CharacterMakerSugar;
@@ -224,7 +224,7 @@
GrammarParser parser = new GrammarParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/quasiliteral/term/TermParser.java
===================================================================
--- jsrc/org/quasiliteral/term/TermParser.java (revision 721)
+++ jsrc/org/quasiliteral/term/TermParser.java (working copy)
@@ -11,7 +11,7 @@
//#line 9 "term.y"
package org.quasiliteral.term;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.erights.e.meta.java.lang.CharacterMakerSugar;
@@ -477,7 +477,7 @@
TermParser parser = new TermParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/quasiliteral/term/term.y
===================================================================
--- jsrc/org/quasiliteral/term/term.y (revision 721)
+++ jsrc/org/quasiliteral/term/term.y (working copy)
@@ -8,7 +8,7 @@
%{
package org.quasiliteral.term;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.erights.e.meta.java.lang.CharacterMakerSugar;
@@ -277,7 +277,7 @@
TermParser parser = new TermParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/erights/e/elang/interp/ImportLoader.java
===================================================================
--- jsrc/org/erights/e/elang/interp/ImportLoader.java (revision 721)
+++ jsrc/org/erights/e/elang/interp/ImportLoader.java (working copy)
@@ -20,7 +20,7 @@
*/
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.trace.Trace;
import org.erights.e.elang.evm.EExpr;
import org.erights.e.elang.scope.Scope;
@@ -121,7 +121,7 @@
try {
return URLSugar.getTwine(resource);
} catch (IOException ioe) {
- throw new NestedException(ioe, "# getting E source");
+ throw new EBacktraceException(ioe, "# getting E source");
}
}
}
Index: jsrc/org/erights/e/elang/syntax/EParser.java
===================================================================
--- jsrc/org/erights/e/elang/syntax/EParser.java (revision 721)
+++ jsrc/org/erights/e/elang/syntax/EParser.java (working copy)
@@ -12,7 +12,7 @@
//#line 30 "e.y"
package org.erights.e.elang.syntax;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.exception.PrintStreamWriter;
import org.erights.e.develop.assertion.T;
import org.erights.e.elang.evm.ENode;
@@ -800,7 +800,7 @@
hash);
}
} catch (Exception ex) {
- throw new NestedException(ex, "# initing parser");
+ throw new EBacktraceException(ex, "# initing parser");
}
}
@@ -1533,7 +1533,7 @@
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/erights/e/elang/syntax/e.y
===================================================================
--- jsrc/org/erights/e/elang/syntax/e.y (revision 721)
+++ jsrc/org/erights/e/elang/syntax/e.y (working copy)
@@ -29,7 +29,7 @@
%{
package org.erights.e.elang.syntax;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.exception.PrintStreamWriter;
import org.erights.e.develop.assertion.T;
import org.erights.e.elang.evm.ENode;
@@ -1755,7 +1755,7 @@
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/org/erights/e/elang/syntax/BaseENodeBuilder.java
===================================================================
--- jsrc/org/erights/e/elang/syntax/BaseENodeBuilder.java (revision 721)
+++ jsrc/org/erights/e/elang/syntax/BaseENodeBuilder.java (working copy)
@@ -5,7 +5,7 @@
import org.erights.e.develop.assertion.T;
import org.erights.e.develop.exception.ExceptionMgr;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elang.evm.AssignExpr;
import org.erights.e.elang.evm.AtomicExpr;
import org.erights.e.elang.evm.AuditorExprs;
@@ -193,7 +193,7 @@
if (null == optSpan) {
throw sex;
}
- throw new NestedException(sex, "@ " + optSpan);
+ throw new EBacktraceException(sex, "@ " + optSpan);
}
}
Index: jsrc/org/erights/e/elang/evm/ParseNode.java
===================================================================
--- jsrc/org/erights/e/elang/evm/ParseNode.java (revision 721)
+++ jsrc/org/erights/e/elang/evm/ParseNode.java (working copy)
@@ -20,7 +20,7 @@
*/
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.base.SourceSpan;
import org.erights.e.elib.oldeio.EPrintable;
import org.erights.e.elib.oldeio.TextWriter;
@@ -199,7 +199,7 @@
if (null != optPoser) {
SourceSpan optSpan = optPoser.myOptSpan;
if (null != optSpan) {
- problem = new NestedException(problem, "@ " + optSpan);
+ problem = new EBacktraceException(problem, "@ " + optSpan);
}
}
throw problem;
@@ -266,7 +266,7 @@
try {
subPrintOn(tw, PR_START);
} catch (IOException iox) {
- throw new NestedException(iox, "# in ParseNode.asText()");
+ throw new EBacktraceException(iox, "# in ParseNode.asText()");
}
return sb.toString();
}
Index: jsrc/org/erights/e/elib/debug/CallCounter.java
===================================================================
--- jsrc/org/erights/e/elib/debug/CallCounter.java (revision 721)
+++ jsrc/org/erights/e/elib/debug/CallCounter.java (working copy)
@@ -3,7 +3,7 @@
// Copyright 2002 Combex, Inc. under the terms of the MIT X license
// found at http://www.opensource.org/licenses/mit-license.html ...............
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.exception.ThrowableSugar;
import org.erights.e.elib.base.Ejection;
import org.erights.e.elib.base.SourceSpan;
@@ -91,7 +91,7 @@
if (null != myOptSpan) {
msg += ": " + myOptSpan;
}
- return new NestedException(problem, msg);
+ return new EBacktraceException(problem, msg);
}
}
Index: jsrc/org/erights/e/elib/prim/StaticMaker.java
===================================================================
--- jsrc/org/erights/e/elib/prim/StaticMaker.java (revision 721)
+++ jsrc/org/erights/e/elib/prim/StaticMaker.java (working copy)
@@ -19,11 +19,8 @@
Contributor(s): ______________________________________.
*/
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.base.Callable;
import org.erights.e.elib.base.ClassDesc;
import org.erights.e.elib.base.MessageDesc;
@@ -37,10 +34,15 @@
import org.erights.e.elib.serial.Persistent;
import org.erights.e.elib.slot.Guard;
import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EMap;
import org.erights.e.elib.tables.FlexList;
import org.erights.e.elib.tables.FlexMap;
import org.erights.e.elib.util.AlreadyDefinedException;
+import org.erights.e.elib.util.ClassCache;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+
/**
* How a Java class's static methods are made accessible to E.
* <p/>
@@ -100,7 +102,7 @@
StaticMethodNode.defineMembers(myVTable, safeJ.getOptSugaredBy(), \
SafeJ.ALL); }
} catch (AlreadyDefinedException ade) {
- throw new NestedException(ade, "# can't wrap class: " + clazz);
+ throw new EBacktraceException(ade, "# can't wrap class: " + clazz);
}
}
Index: jsrc/org/erights/e/elib/prim/ScriptMaker.java
===================================================================
--- jsrc/org/erights/e/elib/prim/ScriptMaker.java (revision 721)
+++ jsrc/org/erights/e/elib/prim/ScriptMaker.java (working copy)
@@ -19,7 +19,7 @@
Contributor(s): ______________________________________.
*/
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.base.Callable;
import org.erights.e.elib.base.Script;
import org.erights.e.elib.base.ValueThunk;
@@ -88,7 +88,7 @@
try {
return ClassCache.forName(promotionName);
} catch (Exception ex) {
- throw new NestedException(ex, "# promotion not found");
+ throw new EBacktraceException(ex, "# promotion not found");
}
}
@@ -180,7 +180,7 @@
try {
return ClassCache.forName(sugarName);
} catch (Exception ex) {
- throw new NestedException(ex,
+ throw new EBacktraceException(ex,
"# sweetener not found: " + sugarName);
}
}
Index: jsrc/org/erights/e/elib/prim/Thrower.java
===================================================================
--- jsrc/org/erights/e/elib/prim/Thrower.java (revision 721)
+++ jsrc/org/erights/e/elib/prim/Thrower.java (working copy)
@@ -4,7 +4,7 @@
// found at http://www.opensource.org/licenses/mit-license.html ...............
import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.util.OneArgFunc;
/**
@@ -65,7 +65,7 @@
return problem;
}
optEjector.run(problem);
- throw new NestedException(problem,
+ throw new EBacktraceException(problem,
"# optEjector returned: " + optEjector);
}
Index: jsrc/org/erights/e/elib/prim/E.java
===================================================================
--- jsrc/org/erights/e/elib/prim/E.java (revision 721)
+++ jsrc/org/erights/e/elib/prim/E.java (working copy)
@@ -19,7 +19,7 @@
Contributor(s): ______________________________________.
*/
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.exception.ThrowableSugar;
import org.erights.e.develop.format.StringHelper;
import org.erights.e.elib.base.ClassDesc;
@@ -242,7 +242,7 @@
String verb,
Object[] args) {
if (Backtracing) {
- return new NestedException(ex, "# Problem reporting problem!");
+ return new EBacktraceException(ex, "# Problem reporting problem!");
}
try {
@@ -253,10 +253,10 @@
return (Ejection)leaf;
}
String msg = ". " + abbrevCall(rec, ".", verb, args);
- return new NestedException(ex, msg);
+ return new EBacktraceException(ex, msg);
} catch (Throwable th) {
- return new NestedException(ex, "# Problem reporting (" + th + ")");
+ return new EBacktraceException(ex, "# Problem reporting (" + th + ")");
} finally {
Backtracing = false;
Index: jsrc/org/erights/e/elib/base/Ejection.java
===================================================================
--- jsrc/org/erights/e/elib/base/Ejection.java (revision 721)
+++ jsrc/org/erights/e/elib/base/Ejection.java (working copy)
@@ -1,6 +1,6 @@
package org.erights.e.elib.base;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.exception.ThrowableSugar;
/*
@@ -39,7 +39,7 @@
* unwrapped and optMsg is ignored.
*
* @param optMsg may equivalently be null or "", in which case it will be
- * ignored by eStack(). See {@link \
org.erights.e.develop.exception.NestedThrowable} + * ignored by \
eStack(). See {@link \
org.erights.e.develop.exception.EBacktraceThrowable}
* for the convention that optMsg should follow.
*/
static public RuntimeException backtrace(Throwable problem,
@@ -54,7 +54,7 @@
if (problem instanceof RuntimeException && 0 == optMsg.length()) {
return (RuntimeException)problem;
}
- return new NestedException(problem, optMsg);
+ return new EBacktraceException(problem, optMsg);
}
/**
Index: jsrc/org/erights/e/elib/tables/Equalizer.java
===================================================================
--- jsrc/org/erights/e/elib/tables/Equalizer.java (revision 721)
+++ jsrc/org/erights/e/elib/tables/Equalizer.java (working copy)
@@ -4,7 +4,7 @@
// found at http://www.opensource.org/licenses/mit-license.html ...............
import org.erights.e.develop.exception.ExceptionMgr;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.base.ClassDesc;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.prim.ScriptMaker;
@@ -106,7 +106,7 @@
try {
return ClassCache.forName(simpName);
} catch (Exception ex) {
- throw new NestedException(ex,
+ throw new EBacktraceException(ex,
"# simplification not found: " +
simpName);
}
Index: jsrc/org/erights/e/elib/tables/ArrayHelper.java
===================================================================
--- jsrc/org/erights/e/elib/tables/ArrayHelper.java (revision 721)
+++ jsrc/org/erights/e/elib/tables/ArrayHelper.java (working copy)
@@ -3,7 +3,7 @@
package org.erights.e.elib.tables;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.prim.E;
import org.erights.e.meta.java.math.EInt;
@@ -179,7 +179,7 @@
try {
Array.set(array, index, val);
} catch (IllegalArgumentException iae2) {
- throw new NestedException(iae2,
+ throw new EBacktraceException(iae2,
"# Can't fit " + E.toQuote(val) +
" into array of " + type);
}
Index: jsrc/org/erights/e/elib/tables/FlexMap.java
===================================================================
--- jsrc/org/erights/e/elib/tables/FlexMap.java (revision 721)
+++ jsrc/org/erights/e/elib/tables/FlexMap.java (working copy)
@@ -19,7 +19,7 @@
Contributor(s): ______________________________________.
*/
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.oldeio.TextWriter;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.serial.PassByProxy;
@@ -86,7 +86,8 @@
* If the key is overwritten, then the key order is unchanged. If the key
* is novel, it's added to the end of the order.
*
- * @throws NestedException of NotSettledException if the key is not settled
+ * @throws (EBacktraceException of) NotSettledException if the key is not
+ * settled
* @see org.erights.e.elib.ref.Ref#isSettled
*/
public abstract void put(Object key, Object value, boolean strict);
Index: jsrc/org/erights/e/ui/awt/EAction.java
===================================================================
--- jsrc/org/erights/e/ui/awt/EAction.java (revision 721)
+++ jsrc/org/erights/e/ui/awt/EAction.java (working copy)
@@ -3,7 +3,7 @@
// Copyright 2002 Combex, Inc. under the terms of the MIT X license
// found at http://www.opensource.org/licenses/mit-license.html ...............
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.develop.format.StringHelper;
import org.erights.e.elib.oldeio.EPrintable;
import org.erights.e.elib.oldeio.TextWriter;
@@ -249,13 +249,13 @@
try {
field = KeyEvent.class.getField("VK_" + accel);
} catch (NoSuchFieldException nsfe) {
- throw new NestedException(nsfe, "# building menu: " + accel);
+ throw new EBacktraceException(nsfe, "# building menu: " + accel);
}
int c;
try {
c = field.getInt(null);
} catch (IllegalAccessException iae) {
- throw new NestedException(iae, "# building menu: " + field);
+ throw new EBacktraceException(iae, "# building menu: " + field);
}
KeyStroke stroke = KeyStroke.getKeyStroke(c, mask);
Index: jsrc/org/erights/e/develop/exception/NestedException.java
===================================================================
--- jsrc/org/erights/e/develop/exception/NestedException.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/NestedException.java (working copy)
@@ -1,46 +0,0 @@
-package org.erights.e.develop.exception;
-
-/*
-The contents of this file are subject to the Electric Communities E Open
-Source Code License Version 1.0 (the "License"); you may not use this file
-except in compliance with the License. You may obtain a copy of the License
-at http://www.communities.com/EL/.
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-the specific language governing rights and limitations under the License.
-
-The Original Code is the Distributed E Language Implementation, released
-July 20, 1998.
-
-The Initial Developer of the Original Code is Electric Communities.
-Copyright (C) 1998 Electric Communities. All Rights Reserved.
-
-Contributor(s): ______________________________________.
-*/
-
-/**
- * Nested version of the Java RuntimeException class.
- */
-public class NestedException extends RuntimeException
- implements NestedThrowable {
-
- static private final long serialVersionUID = 2241355872285197147L;
-
- private final Throwable myContainedThrowable;
-
- /**
- * See {@link NestedThrowable} for the convention that msg should follow.
- */
- public NestedException(Throwable t, String msg) {
- super(msg);
- myContainedThrowable = t;
- }
-
- /**
- *
- */
- public Throwable getNestedThrowable() {
- return myContainedThrowable;
- }
-}
Index: jsrc/org/erights/e/develop/exception/EBacktraceException.java
===================================================================
--- jsrc/org/erights/e/develop/exception/EBacktraceException.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/EBacktraceException.java (working copy)
@@ -20,27 +20,22 @@
*/
/**
- * Nested version of the Java RuntimeException class.
+ * Backtrace version of the Java RuntimeException class.
+ *
+ * This is identical to RuntimeException except that it indicates that this
+ * exception should be unwrapped as part of the E backtrace-reporting
+ * mechanisms, and its message follows the convention described in
+ * {@link EBacktraceThrowable}.
*/
-public class NestedException extends RuntimeException
- implements NestedThrowable {
+public class EBacktraceException extends RuntimeException
+ implements EBacktraceThrowable {
- static private final long serialVersionUID = 2241355872285197147L;
+ static private final long serialVersionUID = 2636038350623448267L;
- private final Throwable myContainedThrowable;
-
/**
- * See {@link NestedThrowable} for the convention that msg should follow.
+ * See {@link EBacktraceThrowable} for the convention that msg should follow.
*/
- public NestedException(Throwable t, String msg) {
- super(msg);
- myContainedThrowable = t;
+ public EBacktraceException(Throwable t, String msg) {
+ super(msg, t);
}
-
- /**
- *
- */
- public Throwable getNestedThrowable() {
- return myContainedThrowable;
- }
}
Index: jsrc/org/erights/e/develop/exception/ExceptionMgr.java
===================================================================
--- jsrc/org/erights/e/develop/exception/ExceptionMgr.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/ExceptionMgr.java (working copy)
@@ -49,7 +49,10 @@
if (th instanceof RuntimeException) {
return (RuntimeException)th;
}
- return new NestedException(th, "");
+ // XXX review: in the new getCause()-based world, should this be not
+ // a backtrace exception but a plain RuntimeException? If so, how
+ // should the backtrace facilities know to walk through it?
+ return new EBacktraceException(th, "");
}
/**
Index: jsrc/org/erights/e/develop/exception/NestedIOException.java
===================================================================
--- jsrc/org/erights/e/develop/exception/NestedIOException.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/NestedIOException.java (working copy)
@@ -1,47 +0,0 @@
-package org.erights.e.develop.exception;
-
-/*
-The contents of this file are subject to the Electric Communities E Open
-Source Code License Version 1.0 (the "License"); you may not use this file
-except in compliance with the License. You may obtain a copy of the License
-at http://www.communities.com/EL/.
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-the specific language governing rights and limitations under the License.
-
-The Original Code is the Distributed E Language Implementation, released
-July 20, 1998.
-
-The Initial Developer of the Original Code is Electric Communities.
-Copyright (C) 1998 Electric Communities. All Rights Reserved.
-
-Contributor(s): ______________________________________.
-*/
-
-import java.io.IOException;
-
-/**
- * Nested version of the Java IOException class.
- */
-public class NestedIOException extends IOException implements NestedThrowable {
-
- static private final long serialVersionUID = 7178739108699472895L;
-
- private final Throwable myContainedThrowable;
-
- /**
- *
- */
- public NestedIOException(Throwable t, String msg) {
- super(msg);
- myContainedThrowable = t;
- }
-
- /**
- *
- */
- public Throwable getNestedThrowable() {
- return myContainedThrowable;
- }
-}
Index: jsrc/org/erights/e/develop/exception/ThrowableSugar.java
===================================================================
--- jsrc/org/erights/e/develop/exception/ThrowableSugar.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/ThrowableSugar.java (working copy)
@@ -96,24 +96,28 @@
* Returns the Throwable wrapped by self.
* <p/>
* If self doesn't wrap a Throwable, return null.
+ * <p/>
+ * XXX This is now deprecated in favor of the Java 1.4 getCause() method.
+ * Its original behavior has been preserved: it will unwrap E backtrace
+ * exceptions and the Java standard library exceptions
+ * {@link java.lang.ExceptionInInitializerError},
+ * {@link java.lang.reflect.InvocationTargetException}, and
+ * {@link java.lang.reflect.UndeclaredThrowableException}.
*/
static public Throwable unwrap(Throwable self) {
- if (self instanceof NestedThrowable) {
- return ((NestedThrowable)self).getNestedThrowable();
- } else if (self instanceof ExceptionInInitializerError) {
- return ((ExceptionInInitializerError)self).getException();
- } else if (self instanceof InvocationTargetException) {
- return ((InvocationTargetException)self).getTargetException();
- } else if (self instanceof UndeclaredThrowableException) {
- return ((UndeclaredThrowableException)self).
- getUndeclaredThrowable();
+ if (self instanceof EBacktraceThrowable
+ || self instanceof ExceptionInInitializerError
+ || self instanceof InvocationTargetException
+ || self instanceof UndeclaredThrowableException) {
+ return self.getCause();
} else {
return null;
}
}
/**
- * Return the non-wrapping throwable at the end of a wrapping chain
+ * Return the non-wrapping throwable at the end of a wrapping chain:
+ * repeatedly {@link unwrap()}.
*/
static public Throwable leaf(Throwable self) {
while (true) {
Index: jsrc/org/erights/e/develop/exception/NestedThrowable.java
===================================================================
--- jsrc/org/erights/e/develop/exception/NestedThrowable.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/NestedThrowable.java (working copy)
@@ -1,41 +0,0 @@
-package org.erights.e.develop.exception;
-
-/*
-The contents of this file are subject to the Electric Communities E Open
-Source Code License Version 1.0 (the "License"); you may not use this file
-except in compliance with the License. You may obtain a copy of the License
-at http://www.communities.com/EL/.
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-the specific language governing rights and limitations under the License.
-
-The Original Code is the Distributed E Language Implementation, released
-July 20, 1998.
-
-The Initial Developer of the Original Code is Electric Communities.
-Copyright (C) 1998 Electric Communities. All Rights Reserved.
-
-Contributor(s): ______________________________________.
-*/
-
-/**
- * Wraps a Throwable in order to turn it into some other kind of Throwable, in
- * order to add backtrace info, or both.
- * <p/>
- * For a NestedThrowable, the convention for the message is that it should be
- * empty, or each line should begin with <ul> <li>"# " to indicate a message
- * intended only for human parsing. <li>". " to indicate a printing of a
- * problematic call's value <li>"@ " to indicate where the problem occurred
- * <li>"- " to indicate what was called. </ul> If the message is empty, it will
- * be ignored by {@link ThrowableSugar#eStack}.
- *
- * @author modification by Mark S. Miller
- */
-public interface NestedThrowable {
-
- /**
- *
- */
- Throwable getNestedThrowable();
-}
Index: jsrc/org/erights/e/develop/exception/EBacktraceIOException.java
===================================================================
--- jsrc/org/erights/e/develop/exception/EBacktraceIOException.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/EBacktraceIOException.java (working copy)
@@ -22,26 +22,21 @@
import java.io.IOException;
/**
- * Nested version of the Java IOException class.
+ * Backtrace version of the Java IOException class.
+ *
+ * This is identical to RuntimeException except that it indicates that this
+ * exception should be unwrapped as part of the E backtrace-reporting
+ * mechanisms, and its message follows the convention described in
+ * {@link EBacktraceThrowable}.
*/
-public class NestedIOException extends IOException implements NestedThrowable {
+public class EBacktraceIOException extends IOException implements \
EBacktraceThrowable {
- static private final long serialVersionUID = 7178739108699472895L;
+ static private final long serialVersionUID = 8627311147539613684L;
- private final Throwable myContainedThrowable;
-
/**
*
*/
- public NestedIOException(Throwable t, String msg) {
- super(msg);
- myContainedThrowable = t;
+ public EBacktraceIOException(Throwable t, String msg) {
+ super(msg, t);
}
-
- /**
- *
- */
- public Throwable getNestedThrowable() {
- return myContainedThrowable;
- }
}
Index: jsrc/org/erights/e/develop/exception/NestedError.java
===================================================================
--- jsrc/org/erights/e/develop/exception/NestedError.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/NestedError.java (working copy)
@@ -1,45 +0,0 @@
-package org.erights.e.develop.exception;
-
-/*
-The contents of this file are subject to the Electric Communities E Open
-Source Code License Version 1.0 (the "License"); you may not use this file
-except in compliance with the License. You may obtain a copy of the License
-at http://www.communities.com/EL/.
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-the specific language governing rights and limitations under the License.
-
-The Original Code is the Distributed E Language Implementation, released
-July 20, 1998.
-
-The Initial Developer of the Original Code is Electric Communities.
-Copyright (C) 1998 Electric Communities. All Rights Reserved.
-
-Contributor(s): ______________________________________.
-*/
-
-/**
- * Nested version of the Java Error class
- */
-public class NestedError extends Error implements NestedThrowable {
-
- static private final long serialVersionUID = -8224390403639236240L;
-
- private final Throwable myContainedThrowable;
-
- /**
- *
- */
- public NestedError(Throwable t, String msg) {
- super(msg);
- myContainedThrowable = t;
- }
-
- /**
- *
- */
- public Throwable getNestedThrowable() {
- return myContainedThrowable;
- }
-}
Index: jsrc/org/erights/e/develop/exception/EBacktraceThrowable.java
===================================================================
--- jsrc/org/erights/e/develop/exception/EBacktraceThrowable.java (revision 721)
+++ jsrc/org/erights/e/develop/exception/EBacktraceThrowable.java (working copy)
@@ -20,10 +20,9 @@
*/
/**
- * Wraps a Throwable in order to turn it into some other kind of Throwable, in
- * order to add backtrace info, or both.
+ * Wraps a Throwable (stored in the cause field) in order to add backtrace info.
* <p/>
- * For a NestedThrowable, the convention for the message is that it should be
+ * For a EBacktraceThrowable, the convention for the message is that it should be
* empty, or each line should begin with <ul> <li>"# " to indicate a message
* intended only for human parsing. <li>". " to indicate a printing of a
* problematic call's value <li>"@ " to indicate where the problem occurred
@@ -32,10 +31,5 @@
*
* @author modification by Mark S. Miller
*/
-public interface NestedThrowable {
-
- /**
- *
- */
- Throwable getNestedThrowable();
+public interface EBacktraceThrowable {
}
Index: jsrc/com/hp/orc/OrcParser.java
===================================================================
--- jsrc/com/hp/orc/OrcParser.java (revision 721)
+++ jsrc/com/hp/orc/OrcParser.java (working copy)
@@ -11,7 +11,7 @@
//#line 5 "orc.y"
package com.hp.orc;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.quasiliteral.astro.Astro;
@@ -390,7 +390,7 @@
OrcParser parser = new OrcParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
Index: jsrc/com/hp/orc/orc.y
===================================================================
--- jsrc/com/hp/orc/orc.y (revision 721)
+++ jsrc/com/hp/orc/orc.y (working copy)
@@ -4,7 +4,7 @@
%{
package com.hp.orc;
-import org.erights.e.develop.exception.NestedException;
+import org.erights.e.develop.exception.EBacktraceException;
import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.Twine;
import org.quasiliteral.astro.Astro;
@@ -212,7 +212,7 @@
OrcParser parser = new OrcParser(lexer, builder);
return parser.parse();
} catch (IOException iox) {
- throw new NestedException(iox, "# parsing a string?!");
+ throw new EBacktraceException(iox, "# parsing a string?!");
}
}
--
Kevin Reid <http://switchb.org/kpreid/>
_______________________________________________
e-lang mailing list
e-lang@mail.eros-os.org
http://www.eros-os.org/mailman/listinfo/e-lang
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic