From a407eb037f9726dcd936a5ae9195ae14b1f7f33f Mon Sep 17 00:00:00 2001
From: PeiYong Zhang <peiyongz@apache.org>
Date: Mon, 10 Jun 2002 20:14:00 +0000
Subject: [PATCH] Bug# 1687: resValue not always updated when making a
 transcoder,                    patch from tng.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173814 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/util/TransService.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/xercesc/util/TransService.cpp b/src/xercesc/util/TransService.cpp
index 46ebe90bb..46f9a4462 100644
--- a/src/xercesc/util/TransService.cpp
+++ b/src/xercesc/util/TransService.cpp
@@ -194,7 +194,10 @@ XMLTransService::makeNewTranscoderFor(  const   XMLCh* const            encoding
     const unsigned int bufSize = 2048;
     XMLCh upBuf[bufSize + 1];
     if (!XMLString::copyNString(upBuf, encodingName, bufSize))
+    {
+        resValue = XMLTransService::InternalFailure;
         return 0;
+    }
     XMLString::upperCase(upBuf);
     ENameMap* ourMapping = gMappings->get(upBuf);
 
@@ -229,7 +232,15 @@ XMLTransService::makeNewTranscoderFor(  const   XMLCh* const            encoding
     //  It wasn't an intrinsic and it wasn't disallowed, so pass it on
     //  to the trans service to see if he can make anything of it.
     //
-    return makeNewXMLTranscoder(encodingName, resValue, blockSize);
+
+    XMLTranscoder* temp =  makeNewXMLTranscoder(encodingName, resValue, blockSize);
+
+    // if successful, set resValue to OK  
+    // if failed, the makeNewXMLTranscoder has already set the proper failing resValue
+    if (temp) resValue =  XMLTransService::Ok;    
+
+    return temp;
+
 }
 
 
-- 
GitLab