DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25093>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25093

[PATCH] Defaults input module does not allow empty values

           Summary: [PATCH] Defaults input module does not allow empty
                    values
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: general components
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


With a cocoon.xconf entry such as

  <component-instance 
class="org.apache.cocoon.components.modules.input.DefaultsModule" name="my">
    <values>
      <foo></foo>
    </values>
  </component-instance>

Cocoon does not start anymore.  The reason is that 
avalon.framework.Configuration considers the value as undefined (rather than 
the empty string), and config.getValue() throws a ConfigurationException.

In the Cocoon sitemap {my:foo} is evaluated to the empty string, if <foo> is 
not defined at all in <values>.  It should do the same, if <foo> is defined but 
with empty value.

Patch:

===================================================================
RCS file: /home/cvspublic/cocoon-
2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsModule.java,v
retrieving revision
diff -u -r1.2
--- cocoon-
2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsModule.java
        2003/03/20 07:31:51     1.2
+++ cocoon-
2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsModule.java
        2003/11/30 12:32:52
@@ -87,7 +87,7 @@
         this.constants = new HashMap();
         Configuration[] consts = config.getChild("values").getChildren();
         for (int i=0; i<consts.length; i++) {
-            this.constants.put(consts[i].getName(), consts[i].getValue());
+            this.constants.put(consts[i].getName(), consts[i].getValue(""));
         }
     }

Reply via email to