(file) Return to Exception.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

File: [Pegasus] / pegasus / src / Pegasus / Common / Exception.cpp (download)
Revision: 1.62, Tue Oct 15 21:04:50 2002 UTC (21 years, 8 months ago) by kumpf
Branch: MAIN
CVS Tags: VERSION_2_1_RELEASE_HEAD, VERSION_2_1_RELEASE_BRANCH, VERSION_2_1_RELEASE, VERSION_2_1_1_RELEASE, LOCAL_ASSOCPROV-ROOT, LOCAL_ASSOCPROV-BRANCH
Branch point for: mday-2-0-patches
Changes since 1.61: +6 -0 lines
HP-SF: Fixed the CIMDateTime code to check for dates that are out of range for the system call mktime. The code now throws an exception if the given date is out of range for mktime. Fixed the Process provider to throw CIM_ERR_NO_SUCH_PROPERTY in case of an unsupported property.

//%/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
// The Open Group, Tivoli Systems
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Mike Brasher (mbrasher@bmc.com)
//
// Modified By: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
//              Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com)
//              Carol Ann Krug Graves, Hewlett-Packard Company
//                (carolann_graves@hp.com)
//              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
//              Sushma Fernandes , Hewlett-Packard Company
//                (sushma_fernandes@hp.com)
//
//%/////////////////////////////////////////////////////////////////////////////

#include <cstdio>
#include "Exception.h"
#include <Pegasus/Common/ExceptionRep.h>
#include <Pegasus/Common/CIMExceptionRep.h>
#include "Tracer.h"

PEGASUS_NAMESPACE_BEGIN

Exception::Exception(const String& message)
{
    _rep = new ExceptionRep();
    _rep->message = message;
}

Exception::Exception(const Exception& exception)
{
    _rep = new ExceptionRep();
    _rep->message = exception._rep->message;
}

Exception::Exception()
{
}

Exception::~Exception()
{
    delete _rep;
}

const String& Exception::getMessage() const
{
    return _rep->message;
}


IndexOutOfBoundsException::IndexOutOfBoundsException()
    : Exception("index out of bounds")
{
}

AlreadyExistsException::AlreadyExistsException(const String& message)
    : Exception("already exists: " + message)
{
}

InvalidNameException::InvalidNameException(const String& name)
    : Exception("invalid CIM name: " + name)
{
}

InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name)
    : Exception("invalid CIM namespace name: " + name)
{
}

UninitializedObjectException::UninitializedObjectException()
    : Exception("uninitialized object")
{
}

TypeMismatchException::TypeMismatchException()
    : Exception("type mismatch")
{
}

DynamicCastFailedException::DynamicCastFailedException()
    : Exception("dynamic cast failed")
{
}

InvalidDateTimeFormatException::InvalidDateTimeFormatException()
    : Exception("invalid datetime format")
{
}

MalformedObjectNameException::MalformedObjectNameException(
    const String& objectName)
    : Exception("malformed object name: " + objectName)
{
}

BindFailedException::BindFailedException(const String& message)
    : Exception("Bind failed: " + message)
{
}

InvalidLocatorException::InvalidLocatorException(const String& locator)
    : Exception("Invalid locator: " + locator)
{
}

CannotCreateSocketException::CannotCreateSocketException()
    : Exception("Cannot create socket")
{
}

CannotConnectException::CannotConnectException(const String& locator)
    : Exception("Cannot connect to: " + locator)
{
}

AlreadyConnectedException::AlreadyConnectedException()
    : Exception("already connected")
{
}

NotConnectedException::NotConnectedException()
    : Exception("not connected")
{
}

ConnectionTimeoutException::ConnectionTimeoutException()
    : Exception("connection timed out")
{
}

SSLException::SSLException(const String& message)
    : Exception("SSL Exception: " + message)
{
}

DateTimeOutOfRangeException::DateTimeOutOfRangeException(const String& message)
    : Exception("DateTime is out of range : " + message)
{
}

////////////////////////////////////////////////////////////////////////////////
//
// CIMException
//
////////////////////////////////////////////////////////////////////////////////

CIMException::CIMException(
    CIMStatusCode code,
    const String& message)
    : Exception()
{
    CIMExceptionRep * tmp = new CIMExceptionRep ();
    tmp->message = message;
    tmp->code = code;
    tmp->file = "";
    tmp->line = 0;
    _rep = tmp;
}

CIMException::CIMException(const CIMException & cimException)
    : Exception()
{
    CIMExceptionRep * tmp = new CIMExceptionRep ();
    CIMExceptionRep * rep;
    rep = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
    tmp->message = rep->message;
    tmp->code = rep->code;
    tmp->file = rep->file;
    tmp->line = rep->line;
    _rep = tmp;
}

CIMException& CIMException::operator=(const CIMException & cimException)
{
    CIMExceptionRep* left;
    CIMExceptionRep* right;
    left = reinterpret_cast<CIMExceptionRep*>(this->_rep);
    right = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
    left->message = right->message;
    left->code = right->code;
    left->file = right->file;
    left->line = right->line;
    return *this;
}

CIMException::~CIMException()
{
}

CIMStatusCode CIMException::getCode() const
{
    CIMExceptionRep* rep;
    rep = reinterpret_cast<CIMExceptionRep*>(_rep);
    return rep->code;
}

PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2