From 24747bdd1c3253092574e8ca965e7653cbff12b7 Mon Sep 17 00:00:00 2001
From: Gareth Reakes <gareth@apache.org>
Date: Wed, 14 May 2003 14:45:41 +0000
Subject: [PATCH] Fix to NetBSD to use PanicHandler. Patch by Hiramatsu
 Yoshifumi.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@174959 13f79535-47bb-0310-9956-ffa450edef68
---
 .../Platforms/NetBSD/NetBSDPlatformUtils.cpp  | 27 ++++---------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
index baa074b35..6dba4e1ba 100644
--- a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
@@ -88,6 +88,7 @@
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
+#include    <xercesc/util/PanicHandler.hpp>
 
 #if defined(XML_USE_ICU_TRANSCODER)
     #include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
@@ -288,7 +289,7 @@ XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain)
 
     catch(...)
     {
-        panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
+        panic(PanicHandler::Panic_CantLoadMsgDomain);
     }
     return retVal;
 }
@@ -318,27 +319,9 @@ XMLTransService* XMLPlatformUtils::makeTransService()
 // ---------------------------------------------------------------------------
 //  XMLPlatformUtils: The panic method
 // ---------------------------------------------------------------------------
-void XMLPlatformUtils::panic(const PanicReasons reason)
-{
-     const char* reasonStr = "Unknown reason";
-    if (reason == Panic_NoTransService)
-        reasonStr = "Could not load a transcoding service";
-    else if (reason == Panic_NoDefTranscoder)
-        reasonStr = "Could not load a local code page transcoder";
-    else if (reason == Panic_CantFindLib)
-        reasonStr = "Could not find the xerces-c DLL";
-    else if (reason == Panic_UnknownMsgDomain)
-        reasonStr = "Unknown message domain";
-    else if (reason == Panic_CantLoadMsgDomain)
-        reasonStr = "Cannot load message domain";
-    else if (reason == Panic_SynchronizationErr)
-        reasonStr = "Cannot synchronize system or mutex";
-    else if (reason == Panic_SystemInit)
-        reasonStr = "Cannot initialize the system or mutex";
-
-    fprintf(stderr, "%s\n", reasonStr);
-    
-    exit(-1);
+void XMLPlatformUtils::panic(const PanicHandler::PanicReasons reason)
+{
+    fgUserPanicHandler? fgUserPanicHandler->panic(reason) : fgDefaultPanicHandler->panic(reason);
 }
 
 
-- 
GitLab