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

svn commit: r156582 - in cocoon/trunk: ./ src/blocks/forms/java/org/apache/cocoon/forms/datatype/

Author: vgritsenko
Date: Tue Mar  8 15:14:28 2005
New Revision: 156582

URL: http://svn.apache.org/viewcvs?view=rev&rev=156582
Log:
CForms: JavaSelectionList implementations can now be Contextualizable and
can build SelectionLists with XMLizable labels.

Modified:
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionList.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionListBuilder.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/StaticSelectionList.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java?view=diff&r1=156581&r2=156582
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java Tue Mar  8 15:14:28 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,26 +31,32 @@
 import org.apache.cocoon.xml.XMLUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
+import org.apache.excalibur.xml.sax.XMLizable;
 
 /**
  * Abstract implementation of a JavaSelectionList
  */
 public abstract class AbstractJavaSelectionList implements JavaSelectionList,
-        Serviceable {
+                                                           Serviceable {
 
     protected Datatype datatype;
     protected ServiceManager manager;
 
     private HashMap attributes;
-    private List items = new ArrayList();
+    private List items;
     private boolean nullable;
-    private boolean rebuild = true;
+    private boolean rebuild;
+
+
+    public AbstractJavaSelectionList() {
+        this.items = new ArrayList();
+        this.rebuild = true;
+    }
+
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#getAttribute(java.lang.String)
-     */
     public String getAttribute(String name) {
         if (this.attributes == null) {
             return null;
@@ -58,72 +64,31 @@
         return (String) this.attributes.get(name);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#removeAttribute(java.lang.String)
-     */
     public void removeAttribute(String name) {
         if (this.attributes != null) {
             this.attributes.remove(name);
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#setAttribute(java.lang.String,
-     *      java.lang.String)
-     */
     public void setAttribute(String name, String value) {
         if (this.attributes == null) {
             this.attributes = new HashMap();
         }
         this.attributes.put(name, value);
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#isNullable()
-     */
     public boolean isNullable() {
         return this.nullable;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#setDatatype(org.apache.cocoon.forms.datatype.Datatype)
-     */
     public void setDatatype(Datatype datatype) {
         this.datatype = datatype;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.JavaSelectionList#setNullable(boolean)
-     */
     public void setNullable(boolean nullable) {
         this.nullable = nullable;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.cocoon.forms.datatype.SelectionList#getDatatype()
-     */
     public Datatype getDatatype() {
         return this.datatype;
     }
@@ -136,33 +101,33 @@
     }
 
     public void generateSaxFragment(ContentHandler contentHandler, Locale locale)
-            throws SAXException {
-        if (this.rebuild)
+    throws SAXException {
+        if (this.rebuild) {
             try {
                 this.items.clear();
-                this.rebuild = this.build();
+                this.rebuild = build();
             } catch (Exception e) {
                 e.printStackTrace();
             }
+        }
+
         Convertor.FormatCache formatCache = new DefaultFormatCache();
-        contentHandler.startElement(Constants.INSTANCE_NS, SELECTION_LIST_EL,
-                Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL,
-                XMLUtils.EMPTY_ATTRIBUTES);
-        if (nullable) {
+        contentHandler.startElement(Constants.INSTANCE_NS, SELECTION_LIST_EL, Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
+
+        if (this.nullable) {
             AttributesImpl voidAttrs = new AttributesImpl();
             voidAttrs.addCDATAAttribute("value", "");
-            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL,
-                    Constants.INSTANCE_PREFIX_COLON + ITEM_EL, voidAttrs);
-            contentHandler.endElement(Constants.INSTANCE_NS, ITEM_EL,
-                    Constants.INSTANCE_PREFIX_COLON + ITEM_EL);
+            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL, voidAttrs);
+            contentHandler.endElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL);
         }
+
         Iterator itemIt = items.iterator();
         while (itemIt.hasNext()) {
             SelectionListItem item = (SelectionListItem) itemIt.next();
             item.generateSaxFragment(contentHandler, locale, formatCache);
         }
-        contentHandler.endElement(Constants.INSTANCE_NS, SELECTION_LIST_EL,
-                Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL);
+
+        contentHandler.endElement(Constants.INSTANCE_NS, SELECTION_LIST_EL, Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL);
     }
 
     /**
@@ -174,7 +139,20 @@
 
     /**
      * Adds a new item to this selection list.
-     * 
+     *
+     * @param value
+     *            a value of the correct type (i.e. the type with which this
+     *            selectionlist is associated)
+     * @param label
+     *            string label, can be null.
+     */
+    protected void addItem(Object value, String label) {
+        this.items.add(new SelectionListItem(value, label));
+    }
+
+    /**
+     * Adds a new item to this selection list.
+     *
      * @param value
      *            a value of the correct type (i.e. the type with which this
      *            selectionlist is associated)
@@ -182,57 +160,57 @@
      *            a SAX-fragment such as a
      *            {@link org.apache.cocoon.xml.SaxBuffer}, can be null
      */
-    protected void addItem(Object value, String label) {
-        items.add(new SelectionListItem(value, label));
+    protected void addItem(Object value, XMLizable label) {
+        this.items.add(new SelectionListItem(value, label));
     }
 
     protected List getItems() {
-        return items;
+        return this.items;
     }
 
     private final class SelectionListItem {
         private final Object value;
 
-        private final String label;
+        private final Object label;
 
         public SelectionListItem(Object value, String label) {
             this.value = value;
             this.label = label;
         }
 
+        public SelectionListItem(Object value, XMLizable label) {
+            this.value = value;
+            this.label = label;
+        }
+
         public Object getValue() {
             return value;
         }
 
         public void generateSaxFragment(ContentHandler contentHandler,
-                Locale locale, Convertor.FormatCache formatCache)
-                throws SAXException {
-            AttributesImpl itemAttrs = new AttributesImpl();
+                                        Locale locale, Convertor.FormatCache formatCache)
+        throws SAXException {
             String stringValue;
             if (this.value == null) {
                 stringValue = "";
             } else {
-                stringValue = datatype.getConvertor().convertToString(value,
-                        locale, formatCache);
+                stringValue = datatype.getConvertor().convertToString(this.value, locale, formatCache);
             }
-            itemAttrs.addCDATAAttribute("value", stringValue);
-            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL,
-                    Constants.INSTANCE_PREFIX_COLON + ITEM_EL, itemAttrs);
-            contentHandler.startElement(Constants.INSTANCE_NS, LABEL_EL,
-                    Constants.INSTANCE_PREFIX_COLON + LABEL_EL,
-                    XMLUtils.EMPTY_ATTRIBUTES);
-            if (label == null) {
-                contentHandler.characters(stringValue.toCharArray(), 0,
-                        stringValue.length());
+
+            AttributesImpl attrs = new AttributesImpl();
+            attrs.addCDATAAttribute("value", stringValue);
+            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL, attrs);
+            contentHandler.startElement(Constants.INSTANCE_NS, LABEL_EL, Constants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
+            if (this.label == null) {
+                contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
+            } else if (this.label instanceof XMLizable) {
+                ((XMLizable) this.label).toSAX(contentHandler);
             } else {
-                contentHandler.characters(label.toCharArray(), 0, label
-                        .length());
+                String stringLabel = (String) this.label;
+                contentHandler.characters(stringLabel.toCharArray(), 0, stringLabel.length());
             }
-            contentHandler.endElement(Constants.INSTANCE_NS, LABEL_EL,
-                    Constants.INSTANCE_PREFIX_COLON + LABEL_EL);
-            contentHandler.endElement(Constants.INSTANCE_NS, ITEM_EL,
-                    Constants.INSTANCE_PREFIX_COLON + ITEM_EL);
+            contentHandler.endElement(Constants.INSTANCE_NS, LABEL_EL, Constants.INSTANCE_PREFIX_COLON + LABEL_EL);
+            contentHandler.endElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL);
         }
     }
-
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionList.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionList.java?view=diff&r1=156581&r2=156582
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionList.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionList.java Tue Mar  8 15:14:28 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,20 +17,19 @@
 
 /**
  * A selection list that takes its values from the custom java class itself.
- *
- *  
+ * @version $Id$
  */
-public interface JavaSelectionList extends SelectionList{
-	
+public interface JavaSelectionList extends SelectionList {
+
 	void setDatatype(Datatype datatype);
-	
+
 	boolean isNullable();
-	
+
 	void setNullable(boolean nullable);
-	
+
 	String getAttribute(String name);
-	
+
 	void setAttribute(String name, String value);
-	
+
 	void removeAttribute(String name);
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionListBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionListBuilder.java?view=diff&r1=156581&r2=156582
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionListBuilder.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/JavaSelectionListBuilder.java Tue Mar  8 15:14:28 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,12 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.avalon.framework.component.Component;
+
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.w3c.dom.Element;
@@ -27,67 +33,64 @@
 
 /**
  * Builds {@link SelectionList}s from a JavaSelectionList class
- * 
- *  
+ *
+ * @version $Id$
  */
-public class JavaSelectionListBuilder extends AbstractLogEnabled implements
-		SelectionListBuilder, Serviceable {
-
+public class JavaSelectionListBuilder extends AbstractLogEnabled
+                                      implements SelectionListBuilder,
+                                                 Contextualizable, Serviceable, ThreadSafe, Component {
+
+    /**
+     * The Avalon Context
+     */
+    private Context context;
+
+    /**
+     * The Service Manager
+     */
 	private ServiceManager manager;
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.cocoon.forms.datatype.SelectionListBuilder#build(org.w3c.dom.Element,
-	 *      org.apache.cocoon.forms.datatype.Datatype)
-	 */
+
+    public void contextualize(Context context) throws ContextException {
+        this.context = context;
+    }
+
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+
 	public SelectionList build(Element selectionListElement, Datatype datatype)
-			throws Exception {
-		String className = DomHelper
-				.getAttribute(selectionListElement, "class");
-		boolean nullable = DomHelper.getAttributeAsBoolean(
-				selectionListElement, "nullable", true);
+    throws Exception {
+		String className = DomHelper.getAttribute(selectionListElement, "class");
+		boolean nullable = DomHelper.getAttributeAsBoolean(selectionListElement, "nullable", true);
 
 		try {
 			Class clasz = Class.forName(className);
 			if (JavaSelectionList.class.isAssignableFrom(clasz)) {
-				JavaSelectionList list = (JavaSelectionList) clasz
-						.newInstance();
-				LifecycleHelper.setupComponent(list, getLogger(), null,
-						this.manager, null, true);
+				JavaSelectionList list = (JavaSelectionList) clasz.newInstance();
+				LifecycleHelper.setupComponent(list, getLogger(), this.context, this.manager, null, true);
 				list.setDatatype(datatype);
 				list.setNullable(nullable);
+
                 // pass the attributes to the SelectionList
 				NamedNodeMap attrs = selectionListElement.getAttributes();
-				int size = attrs.getLength();
+				final int size = attrs.getLength();
 				for (int i = 0; i < size; i++) {
-					Node attr = attrs.item(i);
-					String name = attr.getNodeName();
+					final Node attr = attrs.item(i);
+					final String name = attr.getNodeName();
 					list.setAttribute(name, attr.getNodeValue());
 				}
+
 				return list;
 			} else {
+                getLogger().warn("Class " + className + " does not implement JavaSelectionList, returning empty selection list.");
 				return new StaticSelectionList(datatype);
 			}
-		} catch (ClassNotFoundException e) {
-			e.printStackTrace();
-			throw e;
-		} catch (InstantiationException e) {
-			e.printStackTrace();
-			throw e;
-		} catch (IllegalAccessException e) {
-			e.printStackTrace();
+		} catch (Exception e) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Got exception in build, re-throwing", e);
+            }
 			throw e;
 		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-	 */
-	public void service(ServiceManager manager) throws ServiceException {
-		this.manager = manager;
-
 	}
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/StaticSelectionList.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/StaticSelectionList.java?view=diff&r1=156581&r2=156582
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/StaticSelectionList.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/StaticSelectionList.java Tue Mar  8 15:14:28 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,16 +35,24 @@
  * the items in the list are build once from its source, and then list items are
  * cached as part of this object. In contrast, the {@link DynamicSelectionList}
  * will retrieve its content from its source each time it's needed.
- * 
+ *
  * @version $Id$
  */
 public class StaticSelectionList implements SelectionList {
-    /** The datatype to which this selection list belongs */
+    /**
+     * The datatype to which this selection list belongs
+     */
     private Datatype datatype;
-    private List items = new ArrayList();
+
+    /**
+     * List of SelectionListItems
+     */
+    private List items;
+
 
     public StaticSelectionList(Datatype datatype) {
         this.datatype = datatype;
+        this.items = new ArrayList();
     }
 
     public Datatype getDatatype() {
@@ -54,16 +62,18 @@
     public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
         Convertor.FormatCache formatCache = new DefaultFormatCache();
         contentHandler.startElement(Constants.INSTANCE_NS, SELECTION_LIST_EL, Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
-        Iterator itemIt = items.iterator();
+
+        Iterator itemIt = this.items.iterator();
         while (itemIt.hasNext()) {
-            SelectionListItem item = (SelectionListItem)itemIt.next();
+            final SelectionListItem item = (SelectionListItem) itemIt.next();
             item.generateSaxFragment(contentHandler, locale, formatCache);
         }
+
         contentHandler.endElement(Constants.INSTANCE_NS, SELECTION_LIST_EL, Constants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL);
     }
 
     public List getItems() {
-        return items;
+        return this.items;
     }
 
     /**
@@ -72,7 +82,7 @@
      * @param label a SAX-fragment such as a {@link org.apache.cocoon.xml.SaxBuffer}, can be null
      */
     public void addItem(Object value, XMLizable label) {
-        items.add(new SelectionListItem(value, label));
+        this.items.add(new SelectionListItem(value, label));
     }
 
     public final class SelectionListItem {
@@ -89,21 +99,21 @@
         }
 
         public void generateSaxFragment(ContentHandler contentHandler, Locale locale, Convertor.FormatCache formatCache)
-                throws SAXException
-        {
-            AttributesImpl itemAttrs = new AttributesImpl();
+        throws SAXException {
             String stringValue;
             if (this.value == null) {
                 // Null value translates into the empty string
                 stringValue = "";
             } else {
-                stringValue = datatype.getConvertor().convertToString(value, locale, formatCache);
+                stringValue = datatype.getConvertor().convertToString(this.value, locale, formatCache);
             }
-            itemAttrs.addCDATAAttribute("value", stringValue);
-            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL, itemAttrs);
+
+            AttributesImpl attrs = new AttributesImpl();
+            attrs.addCDATAAttribute("value", stringValue);
+            contentHandler.startElement(Constants.INSTANCE_NS, ITEM_EL, Constants.INSTANCE_PREFIX_COLON + ITEM_EL, attrs);
             contentHandler.startElement(Constants.INSTANCE_NS, LABEL_EL, Constants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
-            if (label != null) {
-                label.toSAX(contentHandler);
+            if (this.label != null) {
+                this.label.toSAX(contentHandler);
             } else {
                 contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
             }

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&r1=156581&r2=156582
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue Mar  8 15:14:28 2005
@@ -427,6 +427,10 @@
    </action>
  </release>
  <release version="2.1.7" date="TBD">
+   <action dev="VG" type="update">
+     CForms: JavaSelectionList implementations can now be Contextualizable and
+     can build SelectionLists with XMLizable labels.
+   </action>
    <action dev="CZ" type="fix" fixes-bug="10277">
      Change the mime-type setting of a reader. See also bug #25121.
    </action>