Kaydet (Commit) 268c606e authored tarafından Kurt Zenker's avatar Kurt Zenker

INTEGRATION: CWS cd02 (1.2.164); FILE MERGED

2004/11/15 16:17:36 dbo 1.2.164.1: #114661# making code more robust, source and destination reference
üst ba74180c
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: mergekeys.cxx,v $ * $RCSfile: mergekeys.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: dbo $ $Date: 2002-06-07 15:14:15 $ * last change: $Author: kz $ $Date: 2005-01-13 18:58:36 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/registry/MergeConflictException.hpp> #include <com/sun/star/registry/MergeConflictException.hpp>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
using namespace ::rtl; using namespace ::rtl;
using namespace ::osl; using namespace ::osl;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -91,7 +93,16 @@ static void mergeKeys( ...@@ -91,7 +93,16 @@ static void mergeKeys(
t_links & links ) t_links & links )
SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) )
{ {
OSL_ASSERT( xDest->isValid() && xSource->isValid() ); if (!xSource.is() || !xSource->isValid()) {
throw registry::InvalidRegistryException(
OUSTR("source key is null or invalid!"),
Reference<XInterface>() );
}
if (!xDest.is() || !xDest->isValid()) {
throw registry::InvalidRegistryException(
OUSTR("destination key is null or invalid!"),
Reference<XInterface>() );
}
// write value // write value
switch (xSource->getValueType()) switch (xSource->getValueType())
...@@ -174,6 +185,11 @@ void SAL_CALL mergeKeys( ...@@ -174,6 +185,11 @@ void SAL_CALL mergeKeys(
Reference< registry::XRegistryKey > const & xSource ) Reference< registry::XRegistryKey > const & xSource )
SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) )
{ {
if (!xDest.is() || !xDest->isValid()) {
throw registry::InvalidRegistryException(
OUSTR("destination key is null or invalid!"),
Reference<XInterface>() );
}
if (xDest->isReadOnly()) if (xDest->isReadOnly())
{ {
throw registry::InvalidRegistryException( throw registry::InvalidRegistryException(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment