cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r630360 - in /cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl: javascript/JavaScriptExpression.java jexl/JSIntrospector.java
Date Fri, 22 Feb 2008 23:52:37 GMT
Author: vgritsenko
Date: Fri Feb 22 15:52:33 2008
New Revision: 630360

URL: http://svn.apache.org/viewvc?rev=630360&view=rev
Log:
cleanup

Modified:
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/javascript/JavaScriptExpression.java
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/jexl/JSIntrospector.java

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/javascript/JavaScriptExpression.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/javascript/JavaScriptExpression.java?rev=630360&r1=630359&r2=630360&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/javascript/JavaScriptExpression.java
(original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/javascript/JavaScriptExpression.java
Fri Feb 22 15:52:33 2008
@@ -30,6 +30,10 @@
 import org.mozilla.javascript.Undefined;
 import org.mozilla.javascript.Wrapper;
 
+/**
+ *
+ * @version $Id$
+ */
 public class JavaScriptExpression extends AbstractExpression {
 
     private Script script;
@@ -55,6 +59,7 @@
         Context ctx = Context.enter();
         try {
             Scriptable scope = ctx.newObject(getScope(rootScope));
+
             // Populate the scope
             Iterator iter = objectModel.entrySet().iterator();
             while (iter.hasNext()) {
@@ -66,14 +71,6 @@
 
             Object result = this.script.exec(ctx, scope);
             return unwrap(result);
-        } catch (Exception e) {
-            // Note: this catch block is only needed for the Rhino in C2.1 where the older
-            //       Rhino does not throw RuntimeExceptions
-            if (e instanceof RuntimeException) {
-                throw (RuntimeException)e;
-            } else {
-                throw new RuntimeException("Runtime exception", e);
-            }
         } finally {
             Context.exit();
         }
@@ -81,21 +78,25 @@
 
     public Iterator iterate(ObjectModel objectModel) throws ExpressionException {
         Object result = evaluate(objectModel);
-        if (result == null)
+        if (result == null) {
             return EMPTY_ITER;
+        }
 
-        if (this.introspector == null)
+        if (this.introspector == null) {
             introspector = new JSIntrospector();
+        }
 
-        Iterator iter = null;
+        Iterator iter;
         try {
             iter = introspector.getIterator(result, new Info("Unknown", 0, 0));
         } catch (Exception e) {
             throw new ExpressionException("Couldn't get an iterator from expression " + getExpression(),
e);
         }
 
-        if (iter == null)
+        if (iter == null) {
             iter = EMPTY_ITER;
+        }
+
         return iter;
     }
 

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/jexl/JSIntrospector.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/jexl/JSIntrospector.java?rev=630360&r1=630359&r2=630360&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/jexl/JSIntrospector.java
(original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/jexl/JSIntrospector.java
Fri Feb 22 15:52:33 2008
@@ -199,7 +199,7 @@
         }
 
         public boolean hasNext() {
-            return index < (int)arr.jsGet_length();
+            return index < (int) arr.getLength();
         }
 
         public Object next() {



Mime
View raw message