Revision: 4379 http://vexi.svn.sourceforge.net/vexi/?rev=4379&view=rev Author: mkpg2 Date: 2012-04-09 20:26:24 +0000 (Mon, 09 Apr 2012) Log Message: -----------
Modified Paths: -------------- trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSU.java trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/Interpreter.jpp trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSExn.jpp Modified: trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp =================================================================== --- trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp 2012-04-09 03:43:07 UTC (rev 4378) +++ trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp 2012-04-09 20:26:24 UTC (rev 4379) @@ -423,7 +423,7 @@ } } else if (renderprops.texture.loadFailed!=null) { //JS res = renderprops.texture.stream; - justTriggerTraps(SC_fill, renderprops.texture.loadFailed.getObject()); + justTriggerTraps(SC_fill, renderprops.texture.loadFailed.asObject()); renderprops.resetFill(); // just in case of previous image / fill dirty(); Modified: trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSU.java =================================================================== --- trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSU.java 2012-04-09 03:43:07 UTC (rev 4378) +++ trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSU.java 2012-04-09 20:26:24 UTC (rev 4379) @@ -69,7 +69,7 @@ HTTPErrorResponse he = (HTTPErrorResponse)e; JSExn je = new JSExn(e.getMessage(),SC_http); Fountain.ByteArray stream = new Fountain.ByteArray(he.bytes); - JS.Obj jeObj = je.getObject(); + JS.Obj jeObj = je.asObject(); jeObj.putSafe(SC_code,JSU.S(he.code)); jeObj.putSafe(SC_stream,stream); String mimetype = he.info.contentType; Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/Interpreter.jpp =================================================================== --- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/Interpreter.jpp 2012-04-09 03:43:07 UTC (rev 4378) +++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/Interpreter.jpp 2012-04-09 20:26:24 UTC (rev 4379) @@ -501,8 +501,8 @@ case THROW:{ JS thrown = (JS)stack.pop(); // If already an exception then we recover the JSExn and rethrow it - if(thrown instanceof JSExn.ExnJSObj){ - JSExn je = ((JSExn.ExnJSObj)thrown).getJSExn(); + if(thrown instanceof JSExn.Obj){ + JSExn je = ((JSExn.Obj)thrown).asJSExn(); je.fillIfEmpty(this); throw je; }else @@ -668,7 +668,7 @@ // run the catch block, this will implicitly run the finally block, if it exists stack.push(o); stack.push(catchMarker); - stack.push(e.getObject()); + stack.push(e.asObject()); f = ((TryMarker)o).f; scope = ((TryMarker)o).scope; pc = ((TryMarker)o).catchLoc; Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSExn.jpp =================================================================== --- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSExn.jpp 2012-04-09 03:43:07 UTC (rev 4378) +++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSExn.jpp 2012-04-09 20:26:24 UTC (rev 4379) @@ -14,12 +14,12 @@ public JS new_(JS[] args) throws JSExn { JS msg = args.length>=1?args[0]:null; JSExn cause = null; - if(args.length>=2 && args[1] instanceof ExnJSObj){ - cause = ((ExnJSObj)args[1]).getJSExn(); + if(args.length>=2 && args[1] instanceof Obj){ + cause = ((JSExn.Obj)args[1]).asJSExn(); } JS type = args.length>=3?args[2]:null; JSExn r = new JSExn(msg, type, cause); - return r.getObject(); + return r.asObject(); } }; @@ -34,7 +34,7 @@ public static final int MAX_BACKTRACE_SIZE = 50; final Basket.List backtrace = new Basket.Array(); - final private ExnJSObj js ; + final private Obj js ; public JSExn(InterruptedException e) { this("JS thread interrupted", SC_interrupted, e); } @@ -54,9 +54,11 @@ public JSExn(JS msg) { this(msg,null); } public JSExn(JS msg, JS type) { this(msg,type,null); } public JSExn(JS msg, JS type, Throwable cause) { this(msg, type, cause, null); } - public JSExn(JS msg, JS type, Throwable cause, Interpreter cx) { + public JSExn(JS msg, JS type, Throwable cause, Interpreter cx) { this(new Obj(msg,type), cause, cx); } + public JSExn(Obj js, Throwable cause, Interpreter cx) { super(cause); - this.js = new ExnJSObj(msg,type); + this.js = js; + js.setJSExn(this); fill(cx); } @@ -78,8 +80,8 @@ Throwable r = super.getCause(); if (r!=null) return r; - JS c = getObject().getSafe(SC_cause); - if (c!=null) return ((ExnJSObj)c).getJSExn(); + JS c = asObject().getSafe(SC_cause); + if (c!=null) return ((Obj)c).asJSExn(); return null; } @@ -138,16 +140,22 @@ } } - public JS.Obj getObject() { return js; } + public Obj asObject() { return js; } + // JSExn JS interface (as !JSExn instanceof JS) // Provides access to the stack trace from JSExn. - public class ExnJSObj extends JS.Obj { - public ExnJSObj(JS msg, JS type) { + static public class Obj extends JS.Obj { + private JSExn exn; + protected Obj(JS msg, JS type) { putSafe(SC_message, msg); putSafe(SC_type, type); } + private void setJSExn(JSExn exn){ this.exn = exn; } + // Get back the JSExn. Used by the interpreter when throwing an ExnJSObj + JSExn asJSExn() { return exn; } + public JS get(JS key) throws JSExn { //#switch(JSU.toString(key)) /*@PAGE(varname=Exception,humanname=Exception Object) @@ -170,8 +178,8 @@ case "backtrace": // FEATURE store backTrace as a JSArray of JS Strings. JSArray r = new JSArray(); - for (int i=0; i<backtrace.size(); i++) { - r.add(JSU.S((String)backtrace.get(i))); + for (int i=0; i<exn.backtrace.size(); i++) { + r.add(JSU.S((String)exn.backtrace.get(i))); } return r; @@ -184,9 +192,9 @@ * @type(Exception) * */ case "cause": - Throwable e = getCause(); + Throwable e = exn.getCause(); if (e instanceof JSExn) { - return ((JSExn)e).getObject(); + return ((JSExn)e).asObject(); } return null; @@ -208,7 +216,7 @@ public void put(JS key, JS val) throws JSExn { //#switch(JSU.toString(key)) case "cause": { - if (!(val instanceof ExnJSObj)) { + if (!(val instanceof Obj)) { throw new JSExn("Not a valid cause: "+ key); } super.put(key,val); @@ -218,13 +226,9 @@ } public String getMessage() { - return JSU.toString(js.getSafe(SC_message)); + return JSU.toString(getSafe(SC_message)); } - // Get back the JSExn. Used by the interpreter when throwing an ExnJSObj - JSExn getJSExn() { - return JSExn.this; - } public JS type() { return SC_exception;} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn