X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fcore%2FIbex.java;h=7b5f8b5288b05e6cb9e66800a0999802bd202599;hp=0a48c5f59f9fa3c30a88f624b8c9b83ac22437f2;hb=592fa04faf2d7c5bbf5fceae5a81da13f4791261;hpb=64b8c4b435a4457e342fd03fc4a725d5ea16da36 diff --git a/src/org/ibex/core/Ibex.java b/src/org/ibex/core/Ibex.java index 0a48c5f..7b5f8b5 100644 --- a/src/org/ibex/core/Ibex.java +++ b/src/org/ibex/core/Ibex.java @@ -10,12 +10,12 @@ import org.ibex.net.*; import org.ibex.crypto.*; /** Singleton class that provides all functionality in the ibex.* namespace */ -public final class Ibex extends JS.Cloneable { +public final class Ibex extends JS implements JS.Cloneable { // FIXME remove this private final JS rr; - public Ibex(Stream rr) { this.rr = bless(rr); } + public Ibex(Stream rr) { try { this.rr = bless(rr);} catch(JSExn e) { throw new Error("should never happen"); } } public JS resolveString(String str, boolean permitAbsolute) throws JSExn { if (str.indexOf("://") != -1) { @@ -161,8 +161,8 @@ public final class Ibex extends JS.Cloneable { case 1: //#switch(name) case "clone": - if (!(a instanceof JS.Cloneable)) throw new JSExn("cannot clone a " + a.getClass().getName()); - return ((JS.Cloneable)a).jsclone(); + if(a == null) throw new JSExn("can't clone the null value"); + return ((JS)a).jsclone(); case "bless": return bless((JS)a); case "ui.browser": Platform.newBrowserWindow((String)a); return null; case "stream.unzip": return new Stream.Zip((Stream)a); @@ -341,19 +341,20 @@ public final class Ibex extends JS.Cloneable { } // FEATURE: move this into builtin.xwar - public Blessing bless(JS b) { return new Ibex.Blessing((JS.Cloneable)b, this, null, null); } + public Blessing bless(JS b) throws JSExn { return new Ibex.Blessing(b, this, null, null); } + // FIXME: Does this really need to extends JS.Clone? public static class Blessing extends JS.Clone { private Ibex ibex; private Template t = null; public Object parentkey = null; public Blessing parent = null; private Hash cache = new Hash(); - public Blessing(JS.Cloneable clonee, Ibex ibex, Blessing parent, Object parentkey) { + public Blessing(JS clonee, Ibex ibex, Blessing parent, Object parentkey) throws JSExn { super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; } public Object get(Object key) throws JSExn { if (key.equals("")) return ((Object)getStatic()); if (cache.get(key) != null) return cache.get(key); - Object ret = new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key); + Object ret = new Blessing((JS)clonee.get(key), ibex, this, key); cache.put(key, ret); return ret; }