cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r122556 - in cocoon/trunk: . src/blocks/forms/java/org/apache/cocoon/forms src/blocks/forms/java/org/apache/cocoon/forms/binding src/blocks/forms/java/org/apache/cocoon/forms/datatype src/blocks/forms/java/org/apache/cocoon/forms/util
Date Thu, 16 Dec 2004 17:40:14 GMT
Author: sylvain
Date: Thu Dec 16 09:40:12 2004
New Revision: 122556

URL: http://svn.apache.org/viewcvs?view=rev&rev=122556
Log:
Fix bug #31668 : Use EntityResolver when parsing CForms files
Modified:
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java
   cocoon/trunk/status.xml

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java?view=diff&rev=122556&p1=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java&r1=122555&p2=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java&r2=122556
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java	(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java	Thu
Dec 16 09:40:12 2004
@@ -150,7 +150,7 @@
             try {
                 InputSource inputSource = new InputSource(source.getInputStream());
                 inputSource.setSystemId(source.getURI());
-                formDocument = DomHelper.parse(inputSource);
+                formDocument = DomHelper.parse(inputSource, this.manager);
             } catch (Exception e) {
                 throw new CascadingException("Could not parse form definition from " +
                                              source.getURI(), e);
@@ -184,7 +184,7 @@
             try {
                 InputSource inputSource = new InputSource(source.getInputStream());
                 inputSource.setSystemId(source.getURI());
-                formDocument = DomHelper.parse(inputSource);
+                formDocument = DomHelper.parse(inputSource, this.manager);
             } catch (Exception e) {
                 throw new CascadingException("Could not parse form definition from " +
                                              source.getURI(), e);

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?view=diff&rev=122556&p1=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r1=122555&p2=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r2=122556
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Thu Dec 16 09:40:12 2004
@@ -96,7 +96,7 @@
                 InputSource is = new InputSource(source.getInputStream());
                 is.setSystemId(source.getURI());
 
-                Document doc = DomHelper.parse(is);
+                Document doc = DomHelper.parse(is, this.manager);
                 Element rootElm = doc.getDocumentElement();
                 if (BindingManager.NAMESPACE.equals(rootElm.getNamespaceURI())) {
                     binding = getBuilderAssistant()

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java?view=diff&rev=122556&p1=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java&r1=122555&p2=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java&r2=122556
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
Thu Dec 16 09:40:12 2004
@@ -127,7 +127,7 @@
             source = resolver.resolveURI(src);
             InputSource inputSource = new InputSource(source.getInputStream());
             inputSource.setSystemId(source.getURI());
-            Document document = DomHelper.parse(inputSource);
+            Document document = DomHelper.parse(inputSource, this.serviceManager);
             Element selectionListElement = document.getDocumentElement();
             if (!Constants.DEFINITION_NS.equals(selectionListElement.getNamespaceURI()) ||
                     !"selection-list".equals(selectionListElement.getLocalName())) {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java?view=diff&rev=122556&p1=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java&r1=122555&p2=cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java&r2=122556
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java	(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java	Thu Dec
16 09:40:12 2004
@@ -18,9 +18,12 @@
 import java.io.IOException;
 import java.util.ArrayList;
 
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.xml.SaxBuffer;
 import org.apache.cocoon.xml.dom.DOMStreamer;
 import org.apache.commons.lang.BooleanUtils;
+import org.apache.excalibur.xml.EntityResolver;
 import org.apache.excalibur.xml.sax.XMLizable;
 import org.apache.xerces.dom.NodeImpl;
 import org.apache.xerces.parsers.DOMParser;
@@ -312,9 +315,12 @@
      * Creates a W3C Document that remembers the location of each element in
      * the source file. The location of element nodes can then be retrieved
      * using the {@link #getLocation(Element)} method.
+     *
+     * @param inputSource the inputSource to read the document from
+     * @param manager the service manager where to lookup the entity resolver
      */
-    public static Document parse(InputSource inputSource)
-            throws SAXException, SAXNotSupportedException, IOException {
+    public static Document parse(InputSource inputSource, ServiceManager manager)
+            throws SAXException, SAXNotSupportedException, IOException, ServiceException
{
         DOMParser domParser = new LocationTrackingDOMParser();
         domParser.setFeature(
                 "http://apache.org/xml/features/dom/defer-node-expansion",
@@ -322,8 +328,19 @@
         domParser.setFeature(
                 "http://apache.org/xml/features/dom/create-entity-ref-nodes",
                 false);
-        domParser.parse(inputSource);
-        return domParser.getDocument();
+        
+        EntityResolver resolver = null;
+        if (manager.hasService(EntityResolver.ROLE)) {
+            resolver = (EntityResolver)manager.lookup(EntityResolver.ROLE);
+            domParser.setEntityResolver(resolver);
+        }
+        
+        try {
+            domParser.parse(inputSource);
+            return domParser.getDocument();
+        } finally {
+            manager.release(resolver);
+        }
     }
 
     /**

Modified: cocoon/trunk/status.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&rev=122556&p1=cocoon/trunk/status.xml&r1=122555&p2=cocoon/trunk/status.xml&r2=122556
==============================================================================
--- cocoon/trunk/status.xml	(original)
+++ cocoon/trunk/status.xml	Thu Dec 16 09:40:12 2004
@@ -447,6 +447,9 @@
    </action>
  </release>
  <release version="2.1.7" date="TBD">
+   <action dev="SW" type="fix" fixes-bug="31668">
+     CForms: the parser used to read form files now uses the EntityResolver defined in cocoon.xconf.
+   </action>
    <action dev="AG" type="fix" fixes-bug="32620" due-to="Micah Dubinko" due-to-email="mdubinko@snapbridge.com">
      Tiny typo in AbstractTextSerializer
    </action>

Mime
View raw message