Fixed bug in updatePrototypes where new Prototypes (that didn't exist when
the evaluator was initialized) weren't created. Correctly rethrow Timeout, Redirection and Concurrency Exceptions in invoke().
This commit is contained in:
parent
fa53c338ac
commit
7a95ff731b
1 changed files with 25 additions and 6 deletions
|
@ -116,8 +116,8 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
* necessary to bootstrap the rest is parsed.
|
* necessary to bootstrap the rest is parsed.
|
||||||
*/
|
*/
|
||||||
private void initialize () {
|
private void initialize () {
|
||||||
Collection prototypes = app.getPrototypes();
|
Collection protos = app.getPrototypes();
|
||||||
for (Iterator i=prototypes.iterator(); i.hasNext(); ) {
|
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
||||||
Prototype proto = (Prototype) i.next ();
|
Prototype proto = (Prototype) i.next ();
|
||||||
initPrototype (proto);
|
initPrototype (proto);
|
||||||
}
|
}
|
||||||
|
@ -271,14 +271,22 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
* engine know it should update its prototype information.
|
* engine know it should update its prototype information.
|
||||||
*/
|
*/
|
||||||
public void updatePrototypes () {
|
public void updatePrototypes () {
|
||||||
// first loop through existing prototypes and update them if necessary
|
Collection protos = app.getPrototypes();
|
||||||
for (Enumeration e=prototypes.elements(); e.hasMoreElements(); ) {
|
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
||||||
TypeInfo info = (TypeInfo) e.nextElement ();
|
Prototype proto = (Prototype) i.next ();
|
||||||
|
TypeInfo info = (TypeInfo) prototypes.get (proto.getName());
|
||||||
|
if (info == null) {
|
||||||
|
// a prototype we don't know anything about yet. Init local update info.
|
||||||
|
initPrototype (proto);
|
||||||
|
info = (TypeInfo) prototypes.get (proto.getName());
|
||||||
|
}
|
||||||
// only update prototype if it has already been initialized.
|
// only update prototype if it has already been initialized.
|
||||||
// otherwise, this will be done on demand
|
// otherwise, this will be done on demand
|
||||||
|
// System.err.println ("CHECKING PROTO: "+info);
|
||||||
if (info.lastUpdate > 0) {
|
if (info.lastUpdate > 0) {
|
||||||
Prototype p = app.typemgr.getPrototype (info.protoName);
|
Prototype p = app.typemgr.getPrototype (info.protoName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
|
// System.err.println ("UPDATING PROTO: "+p);
|
||||||
app.typemgr.updatePrototype(p);
|
app.typemgr.updatePrototype(p);
|
||||||
if (p.getLastUpdate () > info.lastUpdate) {
|
if (p.getLastUpdate () > info.lastUpdate) {
|
||||||
evaluatePrototype(p);
|
evaluatePrototype(p);
|
||||||
|
@ -399,6 +407,12 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
return retval.toJavaObject ();
|
return retval.toJavaObject ();
|
||||||
|
} catch (RedirectException redirect) {
|
||||||
|
throw redirect;
|
||||||
|
} catch (TimeoutException timeout) {
|
||||||
|
throw timeout;
|
||||||
|
} catch (ConcurrencyException concur) {
|
||||||
|
throw concur;
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
// check if this is a redirect exception, which has been converted by fesi
|
// check if this is a redirect exception, which has been converted by fesi
|
||||||
// into an EcmaScript exception, which is why we can't explicitly catch it
|
// into an EcmaScript exception, which is why we can't explicitly catch it
|
||||||
|
@ -786,6 +800,11 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
objectPrototype = op;
|
objectPrototype = op;
|
||||||
protoName = name;
|
protoName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString () {
|
||||||
|
return ("TypeInfo["+protoName+","+new Date(lastUpdate)+"]");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue