cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gre...@apache.org
Subject svn commit: r170618 - /cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java
Date Tue, 17 May 2005 17:10:23 GMT
Author: gregor
Date: Tue May 17 10:10:22 2005
New Revision: 170618

URL: http://svn.apache.org/viewcvs?rev=170618&view=rev
Log:
Only set 'initialized' to true once all other initialization activity for the JavaInterpreter
has occurred without throwing exceptions. The trunk Javaflow works differently, and this patch
does not apply there. This resolves http://issues.apache.org/bugzilla/show_bug.cgi?id=33292

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java?rev=170618&r1=170617&r2=170618&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java
Tue May 17 10:10:22 2005
@@ -72,34 +72,38 @@
         if (initialized) {
             return;
         }
-        if (getLogger().isDebugEnabled())
-            getLogger().debug("initialize java flow interpreter");
 
-        classloader = new ContinuationClassLoader(Thread.currentThread().getContextClassLoader());
+        try {
+            if (getLogger().isDebugEnabled())
+                getLogger().debug("initialize java flow interpreter");
 
-        for (Iterator scripts = needResolve.iterator(); scripts.hasNext();) {
+            classloader = new ContinuationClassLoader(Thread.currentThread().getContextClassLoader());
 
-            String classname = (String) scripts.next();
-            if (getLogger().isDebugEnabled()) 
-                getLogger().debug("registered java class \"" + classname + "\" for flow");
+            for (Iterator scripts = needResolve.iterator(); scripts.hasNext();) {
 
-            if (!Continuable.class.isAssignableFrom(Class.forName(classname))) {
-                getLogger().error("java class \"" + classname + "\" doesn't implement Continuable");
-                continue;
-            }            
+                String classname = (String) scripts.next();
+                if (getLogger().isDebugEnabled())
+                    getLogger().debug("registered java class \"" + classname + "\" for flow");
 
-            Class clazz = classloader.loadClass(classname);
+                if (!Continuable.class.isAssignableFrom(Class.forName(classname))) {
+                    getLogger().error("java class \"" + classname + "\" doesn't implement
Continuable");
+                    continue;
+                }
+
+                Class clazz = classloader.loadClass(classname);
 
-            try {
                 final Map m = ReflectionUtils.discoverMethods(clazz);
                 methods.putAll(m);
-            } catch (Exception e) {
-                throw new ConfigurationException("cannot get methods by reflection", e);
-            }
+                
+                //Only initialize if everything so far hasn't thrown any exceptions.
+                initialized = true;
 
+            }
+        } catch (final Exception e) {
+            throw new ConfigurationException("Cannot initialize JavaInterpreter", e);
         }
 
-        initialized = true;
+       
     }
 
     /**



Mime
View raw message