3
* The contents of this file are subject to the Initial
4
* Developer's Public License Version 1.0 (the "License");
5
* you may not use this file except in compliance with the
6
* License. You may obtain a copy of the License at
7
* http://www.ibphoenix.com/idpl.html.
9
* Software distributed under the License is distributed on
10
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
11
* express or implied. See the License for the specific
12
* language governing rights and limitations under the License.
14
* The contents of this file or any work derived from this file
15
* may not be distributed under any other license whatsoever
16
* without the express prior written permission of the original
20
* The Original Code was created by James A. Starkey for IBPhoenix.
22
* Copyright (c) 1997 - 2000, 2001, 2003 James A. Starkey
23
* Copyright (c) 1997 - 2000, 2001, 2003 Netfrastructure, Inc.
24
* All Rights Reserved.
27
// AdminException.cpp: implementation of the AdminException class.
29
//////////////////////////////////////////////////////////////////////
34
#include "../common/classes/alloc.h"
35
#include "AdminException.h"
38
#define vsnprintf _vsnprintf
39
#define snprintf _snprintf
43
//////////////////////////////////////////////////////////////////////
44
// Construction/Destruction
45
//////////////////////////////////////////////////////////////////////
47
AdminException::AdminException(const char *txt, ...)
53
int ret = vsnprintf (temp, sizeof (temp) - 1, txt, args);
57
int l = sizeof (temp) * 2;
58
char *buffer = new char [l];
59
vsnprintf (buffer, l, txt, args);
63
else if (static_cast<unsigned>(ret) >= sizeof (temp))
66
char *buffer = new char [l];
67
vsnprintf (buffer, l, txt, args);
77
AdminException::~AdminException()
82
const char* AdminException::getText()
87
void AdminException::setLocation(JString file, int lineNumber)
92
int l = sizeof (temp);
94
for (int n = 0; n < 3; ++n)
96
int ret = snprintf (buffer, l, "%s, line %d: %s",
97
(const char*) fileName, lineNumber, (const char*) text);
109
buffer = new char [l];