From 9f2ec5dbd248d640fcf1d2c5110cf58ad9eef8ed Mon Sep 17 00:00:00 2001
From: Tinny Ng <tng@apache.org>
Date: Thu, 6 Jun 2002 20:42:28 +0000
Subject: [PATCH] Regression fix: should assign the returned InputSource from
 resolveEntity to srcToFill.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173803 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/dom/deprecated/DOMParser.hpp   | 2 ++
 src/xercesc/framework/XMLEntityHandler.hpp | 5 +++++
 src/xercesc/internal/XMLScanner2.cpp       | 6 +++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/xercesc/dom/deprecated/DOMParser.hpp b/src/xercesc/dom/deprecated/DOMParser.hpp
index a12c5cfdb..bd255409b 100644
--- a/src/xercesc/dom/deprecated/DOMParser.hpp
+++ b/src/xercesc/dom/deprecated/DOMParser.hpp
@@ -994,6 +994,8 @@ public :
       *                 or <code>null</code> if there is no base URI.
       * @return The value returned by the user installed resolveEntity
       *         method or NULL otherwise to indicate no processing was done.
+      *         The returned InputSource is owned by the parser which is
+      *         responsible to clean up the memory.
       * @see EntityResolver
       * @see XMLEntityHandler
       */
diff --git a/src/xercesc/framework/XMLEntityHandler.hpp b/src/xercesc/framework/XMLEntityHandler.hpp
index 291850fa4..7c6f9aeb4 100644
--- a/src/xercesc/framework/XMLEntityHandler.hpp
+++ b/src/xercesc/framework/XMLEntityHandler.hpp
@@ -56,6 +56,9 @@
 
  /*
   * $Log$
+  * Revision 1.4  2002/06/06 20:41:51  tng
+  * Regression fix: should assign the returned InputSource from resolveEntity to srcToFill.
+  *
   * Revision 1.3  2002/05/31 15:14:07  tng
   * Fix doxygen documentation.
   *
@@ -185,6 +188,8 @@ public:
       *                 or <code>null</code> if there is no base URI.
       * @return The value returned by the SAX resolveEntity method or
       *         NULL otherwise to indicate no processing was done.
+      *         The returned InputSource is owned by the parser which is
+      *         responsible to clean up the memory.
       */
     virtual InputSource* resolveEntity
     (
diff --git a/src/xercesc/internal/XMLScanner2.cpp b/src/xercesc/internal/XMLScanner2.cpp
index 29553af6e..d41eb7596 100644
--- a/src/xercesc/internal/XMLScanner2.cpp
+++ b/src/xercesc/internal/XMLScanner2.cpp
@@ -223,7 +223,7 @@ XMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
 
             XMLAttDef* attDefForWildCard = 0;
             XMLAttDef*  attDef = 0;
-          
+
             if (fGrammarType == Grammar::SchemaGrammarType) {
 
                 //retrieve the att def
@@ -1430,8 +1430,8 @@ void XMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const
             if (!fEntityHandler->expandSystemId(loc, expSysId))
                 expSysId.set(loc);
 
-            fEntityHandler->resolveEntity( XMLUni::fgZeroLenString
-                                         , expSysId.getRawBuffer());
+            srcToFill = fEntityHandler->resolveEntity( XMLUni::fgZeroLenString
+                                                     , expSysId.getRawBuffer());
         }
          else
         {
-- 
GitLab