You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jh...@apache.org on 2005/10/06 14:00:56 UTC

svn commit: r306603 - /cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java

Author: jheymans
Date: Thu Oct  6 05:00:52 2005
New Revision: 306603

URL: http://svn.apache.org/viewcvs?rev=306603&view=rev
Log:
<action dev="JHS" type="fix" fixes-bug="30796" due-to="Max Pfingsthorn" due-to-email="m.pfingsthorn@hippo.nl">
      Fix OutofBoundsException when form element does not have an action attribute
</action>

Modified:
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java?rev=306603&r1=306602&r2=306603&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Thu Oct  6 05:00:52 2005
@@ -419,8 +419,13 @@
             // from the pipeContext
             pipeContext.addFormAttributes(newAttrs);
             String[] namesToTranslate = {"action"};
-            Attributes transAttrs = translateAttributes(newAttrs, namesToTranslate);
-
+            Attributes transAttrs = null;
+            try {
+                transAttrs = translateAttributes(newAttrs, namesToTranslate);
+            } catch (RuntimeException e) {
+                throw new SAXException( e.getMessage() + " " +getLocation());
+            }
+            
             hasInstanceNamespace = hasPrefixMapping(Constants.INSTANCE_NS, Constants.INSTANCE_PREFIX);
             if (!hasInstanceNamespace) {
                 getContentHandler().startPrefixMapping(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS);
@@ -943,7 +948,10 @@
                 String name = names[i];
                 int position = newAtts.getIndex(name);
                 String newValue = pipeContext.translateText(newAtts.getValue(position));
-                newAtts.setValue(position, newValue);
+                if(position>-1)
+                    newAtts.setValue(position, newValue);
+                else
+                    throw new RuntimeException("Attribute \""+name+"\" not present!");
             }
         }
         return newAtts;