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

Diff for /pegasus/src/Pegasus/Common/Exception.cpp between version 1.55 and 1.75.4.1

version 1.55, 2002/08/20 17:39:37 version 1.75.4.1, 2006/01/18 17:37:55
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 28 
Line 34 
 //              Carol Ann Krug Graves, Hewlett-Packard Company //              Carol Ann Krug Graves, Hewlett-Packard Company
 //                (carolann_graves@hp.com) //                (carolann_graves@hp.com)
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Sushma Fernandes , Hewlett-Packard Company
   //                (sushma_fernandes@hp.com)
   //              Amit K Arora, IBM (amita@in.ibm.com) for bug# 1593
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <cstdio> #include <cstdio>
 #include "Exception.h" #include "Exception.h"
   #include <Pegasus/Common/ExceptionRep.h>
 #include <Pegasus/Common/CIMExceptionRep.h> #include <Pegasus/Common/CIMExceptionRep.h>
 #include "Tracer.h" #include "Tracer.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 Exception::Exception(const String& message) : _message(message)  Exception::Exception(const String& message)
   {
       _rep = new ExceptionRep();
       _rep->message = message;
       _rep->contentLanguages.clear();
   }
   
   Exception::Exception(const Exception& exception)
   {
       _rep = new ExceptionRep();
       _rep->message = exception._rep->message;
       _rep->contentLanguages = exception._rep->contentLanguages;    // l10n
   }
   
   // l10n
   Exception::Exception(const MessageLoaderParms& msgParms)
 { {
       _rep = new ExceptionRep();
       _rep->message = MessageLoader::getMessage(
           const_cast<MessageLoaderParms &>(msgParms));
       // Must be after MessageLoader::getMessage call
       _rep->contentLanguages = msgParms.contentlanguages;
   }
   
   Exception::Exception()
   {
       _rep = NULL;
 } }
  
 Exception::~Exception() Exception::~Exception()
 { {
       delete _rep;
 } }
  
 const String& Exception::getMessage() const const String& Exception::getMessage() const
 { {
     return _message;      return _rep->message;
   }
   
   // l10n
   const ContentLanguageList& Exception::getContentLanguages() const
   {
           return _rep->contentLanguages;
 } }
  
   // l10n
   void Exception::setContentLanguages(const ContentLanguageList& langs)
   {
           _rep->contentLanguages = langs;
   }
  
   /*
 IndexOutOfBoundsException::IndexOutOfBoundsException() IndexOutOfBoundsException::IndexOutOfBoundsException()
     : Exception("index out of bounds")     : Exception("index out of bounds")
 { {
 } }
   */
  
   IndexOutOfBoundsException::IndexOutOfBoundsException()
       : Exception(MessageLoaderParms("Common.Exception.INDEX_OUT_OF_BOUNDS_EXCEPTION","index out of bounds"))
   {
   }
   
   /*
 AlreadyExistsException::AlreadyExistsException(const String& message) AlreadyExistsException::AlreadyExistsException(const String& message)
     : Exception("already exists: " + message)     : Exception("already exists: " + message)
 { {
 } }
   */
   
   AlreadyExistsException::AlreadyExistsException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.ALREADY_EXISTS_EXCEPTION",
                                                                   "already exists: $0",
                                                                    message))
   {
   }
  
   AlreadyExistsException::AlreadyExistsException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.ALREADY_EXISTS_EXCEPTION",
                                                                   "already exists: "))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
   
   /*
 InvalidNameException::InvalidNameException(const String& name) InvalidNameException::InvalidNameException(const String& name)
     : Exception("invalid CIM name: " + name)     : Exception("invalid CIM name: " + name)
 { {
 } }
   */
   
   InvalidNameException::InvalidNameException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.INVALID_NAME_EXCEPTION",
                                                                   "invalid CIM name: $0",
                                                                    message))
   {
   }
  
   InvalidNameException::InvalidNameException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.INVALID_NAME_EXCEPTION",
                                                                   "invalid CIM name: "))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
   
   /*
 InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name) InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name)
     : Exception("invalid CIM namespace name: " + name)     : Exception("invalid CIM namespace name: " + name)
 { {
 } }
   */
   
   
   InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name)
       : Exception(MessageLoaderParms("Common.Exception.INVALID_NAMESACE_NAME_EXCEPTION",
                                                                   "invalid CIM namespace name: $0",
                                                                    name))
   {
   }
  
 UninitializedHandleException::UninitializedHandleException()  InvalidNamespaceNameException::InvalidNamespaceNameException(MessageLoaderParms& msgParms)
     : Exception("uninitialized handle")      : Exception(MessageLoaderParms("Common.Exception.INVALID_NAMESPACE_NAME_EXCEPTION",
                                                                   "invalid CIM namespace name: "))
 { {
           _rep->message.append(MessageLoader::getMessage(msgParms));
 } }
  
   /*
 UninitializedObjectException::UninitializedObjectException() UninitializedObjectException::UninitializedObjectException()
     : Exception("uninitialized object")     : Exception("uninitialized object")
 { {
 } }
   */
  
 ExpectedReferenceValueException::ExpectedReferenceValueException()  UninitializedObjectException::UninitializedObjectException()
     : Exception("Expected CIMValue object to be of type reference "      : Exception(MessageLoaderParms("Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                     "in this context")                                                                  "uninitialized object"))
 { {
 } }
  
 MissingReferenceClassNameException::MissingReferenceClassNameException()  /*
     : Exception("missing reference class name")  TypeMismatchException::TypeMismatchException()
       : Exception("type mismatch")
 { {
 } }
   */
  
 TypeMismatchException::TypeMismatchException() TypeMismatchException::TypeMismatchException()
     : Exception("type mismatch")      : Exception(MessageLoaderParms("Common.Exception.TYPE_MISMATCH_EXCEPTION",
                                                                   "type mismatch"))
 { {
 } }
  
 CIMValueInvalidTypeException::CIMValueInvalidTypeException()  TypeMismatchException::TypeMismatchException(const String& message)
     : Exception("invalid CIMValue type")      : Exception(MessageLoaderParms("Common.Exception.TYPE_MISMATCH_EXCEPTION",
                                                                   "type mismatch: $0",message))
 { {
   
   }
   
   TypeMismatchException::TypeMismatchException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.TYPE_MISMATCH_EXCEPTION",
                                                                   "type mismatch: "))
   {
       _rep->message.append(MessageLoader::getMessage(msgParms));
 } }
  
   /*
 DynamicCastFailedException::DynamicCastFailedException() DynamicCastFailedException::DynamicCastFailedException()
     : Exception("dynamic cast failed")     : Exception("dynamic cast failed")
 { {
 } }
   */
   
   DynamicCastFailedException::DynamicCastFailedException()
       : Exception(MessageLoaderParms("Common.Exception.DYNAMIC_CAST_FAILED_EXCEPTION",
                                                                   "dynamic cast failed"))
   {
   }
  
   /*
 InvalidDateTimeFormatException::InvalidDateTimeFormatException() InvalidDateTimeFormatException::InvalidDateTimeFormatException()
     : Exception("invalid datetime format")     : Exception("invalid datetime format")
 { {
 } }
   */
  
 IncompatibleTypesException::IncompatibleTypesException()  InvalidDateTimeFormatException::InvalidDateTimeFormatException()
     : Exception("incompatible types")      : Exception(MessageLoaderParms("Common.Exception.INVALID_DATETIME_FORMAT_EXCEPTION",
                                                                   "invalid datetime format"))
 { {
 } }
  
   /*
 MalformedObjectNameException::MalformedObjectNameException( MalformedObjectNameException::MalformedObjectNameException(
     const String& objectName)     const String& objectName)
     : Exception("malformed object name: " + objectName)     : Exception("malformed object name: " + objectName)
 { {
 } }
   */
   
   MalformedObjectNameException::MalformedObjectNameException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.MALFORMED_OBJECT_NAME_EXCEPTION",
                                                                   "malformed object name: $0",
                                                                    message))
   {
   }
   
   MalformedObjectNameException::MalformedObjectNameException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.MALFORMED_OBJECT_NAME_EXCEPTION",
                                                                   "malformed object name: "))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
  
   /*
 BindFailedException::BindFailedException(const String& message) BindFailedException::BindFailedException(const String& message)
     : Exception("Bind failed: " + message)     : Exception("Bind failed: " + message)
 { {
 } }
   */
   
   BindFailedException::BindFailedException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.BIND_FAILED_EXCEPTION",
                                                                   "Bind failed: $0",
                                                                    message))
   {
   }
   
   BindFailedException::BindFailedException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.BIND_FAILED_EXCEPTION",
                                                                   "Bind failed: "))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
  
   /*
 InvalidLocatorException::InvalidLocatorException(const String& locator) InvalidLocatorException::InvalidLocatorException(const String& locator)
     : Exception("Invalid locator: " + locator)     : Exception("Invalid locator: " + locator)
 { {
 } }
   */
   
   InvalidLocatorException::InvalidLocatorException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.INVALID_LOCATOR_EXCEPTION",
                                                                   "Invalid locator: $0",
                                                                    message))
   {
   }
   
   InvalidLocatorException::InvalidLocatorException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.INVALID_LOCATOR_EXCEPTION",
                                                                   "Invalid locator: "))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
  
   /*
 CannotCreateSocketException::CannotCreateSocketException() CannotCreateSocketException::CannotCreateSocketException()
     : Exception("Cannot create socket")     : Exception("Cannot create socket")
 { {
 } }
   */
  
 CannotConnectException::CannotConnectException(const String& locator)  CannotCreateSocketException::CannotCreateSocketException()
     : Exception("Cannot connect to: " + locator)      : Exception(MessageLoaderParms("Common.Exception.CANNOT_CREATE_SOCKET_EXCEPTION",
                                                                   "Cannot create socket"))
 { {
 } }
  
 UnexpectedFailureException::UnexpectedFailureException()  
     : Exception("Unexpected failure")  CannotConnectException::CannotConnectException(const String& message)//???
       : Exception(message)
 { {
 } }
  
   
   CannotConnectException::CannotConnectException(MessageLoaderParms& msgParms)
       : Exception(msgParms)
   {
   }
   
   /*
 AlreadyConnectedException::AlreadyConnectedException() AlreadyConnectedException::AlreadyConnectedException()
     : Exception("already connected")     : Exception("already connected")
 { {
 } }
   */
   
   AlreadyConnectedException::AlreadyConnectedException()
       : Exception(MessageLoaderParms("Common.Exception.ALREADY_CONNECTED_EXCEPTION",
                                                                   "already connected"))
   {
   }
  
   /*
 NotConnectedException::NotConnectedException() NotConnectedException::NotConnectedException()
     : Exception("not connected")     : Exception("not connected")
 { {
 } }
   */
   
   NotConnectedException::NotConnectedException()
       : Exception(MessageLoaderParms("Common.Exception.NOT_CONNECTED_EXCEPTION",
                                                                   "not connected"))
   {
   }
  
   /*
 ConnectionTimeoutException::ConnectionTimeoutException() ConnectionTimeoutException::ConnectionTimeoutException()
     : Exception("connection timed out")     : Exception("connection timed out")
 { {
 } }
   */
  
   ConnectionTimeoutException::ConnectionTimeoutException()
       : Exception(MessageLoaderParms("Common.Exception.CONNECTION_TIMEOUT_EXCEPTION",
                                                                   "connection timed out"))
   {
   }
   
   /*
 SSLException::SSLException(const String& message) SSLException::SSLException(const String& message)
     : Exception("SSL Exception: " + message)     : Exception("SSL Exception: " + message)
 { {
 } }
   */
   
   SSLException::SSLException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.SSL_EXCEPTION",
                                                                   "SSL Exception: $0" ,
                                                                    message))
   {
   }
   
   SSLException::SSLException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.SSL_EXCEPTION",
                                                                   "SSL Exception: " ))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
   
   /*
   DateTimeOutOfRangeException::DateTimeOutOfRangeException(const String& message)
       : Exception("DateTime is out of range : " + message)
   {
   }
   */
   
   DateTimeOutOfRangeException::DateTimeOutOfRangeException(const String& message)
       : Exception(MessageLoaderParms("Common.Exception.DATETIME_OUT_OF_RANGE_EXCEPTION",
                                                                   "DateTime is out of range : $0" ,
                                                                    message))
   {
   }
   
   DateTimeOutOfRangeException::DateTimeOutOfRangeException(MessageLoaderParms& msgParms)
       : Exception(MessageLoaderParms("Common.Exception.DATETIME_OUT_OF_RANGE_EXCEPTION",
                                                                   "DateTime is out of range : " ))
   {
           _rep->message.append(MessageLoader::getMessage(msgParms));
   }
  
  
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Line 176 
Line 418 
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
   // l10n - note - use this when you have an exception with no
   // detail message, or one with an untranslated detail message
   // The pegasus message associated with code will be translated.
 CIMException::CIMException( CIMException::CIMException(
     CIMStatusCode code,     CIMStatusCode code,
     const String& message)     const String& message)
     :      : Exception()
     Exception(message)  {
       CIMExceptionRep * tmp = new CIMExceptionRep ();
       tmp->message = message;
       tmp->code = code;
       tmp->file = "";
       tmp->line = 0;
       tmp->contentLanguages.clear();
       tmp->cimMessage = String::EMPTY;
       _rep = tmp;
   }
   
   // l10n - note use this when you have an exception with a translated
   // detail message
   // l10n
   CIMException::CIMException(
       CIMStatusCode code,
       const MessageLoaderParms& msgParms)
       : Exception()
 { {
     _rep = new CIMExceptionRep();      CIMExceptionRep * tmp = new CIMExceptionRep ();
     _rep->code = code;      tmp->message = MessageLoader::getMessage(
     _rep->file = "";          const_cast<MessageLoaderParms &>(msgParms));
     _rep->line = 0;      // Must be after MessageLoader::getMessage call
       tmp->contentLanguages = msgParms.contentlanguages;
       tmp->cimMessage = String::EMPTY;
       tmp->code = code;
       tmp->file = "";
       tmp->line = 0;
       _rep = tmp;
 } }
  
 CIMException::CIMException(const CIMException & cimException) CIMException::CIMException(const CIMException & cimException)
     : Exception(cimException.getMessage())      : Exception()
 { {
     _rep = new CIMExceptionRep();      CIMExceptionRep * tmp = new CIMExceptionRep ();
     _rep->code = cimException._rep->code;      CIMExceptionRep * rep;
     _rep->file = cimException._rep->file;      rep = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
     _rep->line = cimException._rep->line;      tmp->message = rep->message;
       tmp->contentLanguages = rep->contentLanguages;  // l10n
       tmp->cimMessage = rep->cimMessage;  // l10n
       tmp->code = rep->code;
       tmp->file = rep->file;
       tmp->line = rep->line;
       _rep = tmp;
 } }
  
 CIMException& CIMException::operator=(const CIMException & cimException) CIMException& CIMException::operator=(const CIMException & cimException)
 { {
     _message = cimException._message;      if (&cimException != this)
     _rep->code = cimException._rep->code;      {
     _rep->file = cimException._rep->file;          CIMExceptionRep* left;
     _rep->line = cimException._rep->line;          CIMExceptionRep* right;
           left = reinterpret_cast<CIMExceptionRep*>(this->_rep);
           right = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
           left->message = right->message;
           left->contentLanguages = right->contentLanguages;  // l10n
           left->cimMessage = right->cimMessage;  // l10n
           left->code = right->code;
           left->file = right->file;
           left->line = right->line;
       }
     return *this;     return *this;
 } }
  
 CIMException::~CIMException() CIMException::~CIMException()
 { {
     delete _rep;  
 } }
  
 CIMStatusCode CIMException::getCode() const CIMStatusCode CIMException::getCode() const
 { {
     return _rep->code;      CIMExceptionRep* rep;
       rep = reinterpret_cast<CIMExceptionRep*>(_rep);
       return rep->code;
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.55  
changed lines
  Added in v.1.75.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2