Author: sylvain
Date: Mon Mar 21 09:48:30 2005
New Revision: 158488

URL: http://svn.apache.org/viewcvs?view=rev&rev=158488
Log:
Avoid breaking on exception if some backends for binding samples aren't 
implemented

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/bindings.js

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/bindings.js
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/bindings.js?view=diff&r1=158487&r2=158488
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/bindings.js 
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/bindings.js Mon 
Mar 21 09:48:30 2005
@@ -69,6 +69,16 @@
     // the back-end model itself however depends on sample and type. 
     var bean = createBeanForSample(backendType, sampleCode);
        
+       if (bean == null) {
+        cocoon.sendPage("textresult-display-pipeline.jx", {
+            title: "Contact list",
+            text: "Sorry the sample '" + sampleCode +
+                "' is not yet available for the backend '" +
+                backendType + "'"
+            }
+        );
+        return;
+    }
     // loads the backend-bean into the form
     form.load(bean);
 
@@ -116,7 +126,11 @@
     } else {
         var factoryFunction = "create" + backendType + "BeanFor" + sampleCode;
         print("Using the bean returned by function " + factoryFunction + "()");
-        return this[factoryFunction].apply();
+        if (this[factoryFunction]) {
+            return this[factoryFunction].apply();
+        } else {
+            return null; // not available
+        }
     }
 }
 


Reply via email to