catch exception by constant reference

This commit is contained in:
Takeshi Abe 2011-12-21 21:57:16 +09:00
parent 7167559379
commit 7958f8244c
14 changed files with 74 additions and 75 deletions

View File

@ -76,7 +76,7 @@ using ::rtl::OUString;
}
}
}
catch( uno::Exception & ex )
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
@ -212,7 +212,7 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPISeriesProp
}
}
}
catch( uno::Exception & rEx )
catch( const uno::Exception & rEx )
{
(void)rEx; // avoid warning for pro build
OSL_TRACE( "Exception caught SchXMLSeriesHelper::createOldAPISeriesPropertySet: %s",
@ -250,7 +250,7 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPIDataPointP
}
}
}
catch( uno::Exception & rEx )
catch( const uno::Exception & rEx )
{
(void)rEx; // avoid warning for pro build

View File

@ -216,7 +216,7 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen
}
}
}
catch( uno::Exception & ex )
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
OSL_FAIL( rtl::OUStringToOString(
@ -334,7 +334,7 @@ bool lcl_isSeriesAttachedToFirstAxis(
xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("AttachedAxisIndex") ) ) >>= nAxisIndex;
bResult = (0==nAxisIndex);
}
catch( uno::Exception & ex )
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
OSL_FAIL( rtl::OUStringToOString(
@ -495,9 +495,8 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque
if( !aHiddenValues.getLength() )
return true;
}
catch( uno::Exception& e )
catch( uno::Exception& )
{
(void)e; // avoid warning
return true;
}
}
@ -787,7 +786,7 @@ void ChartExport::InitRangeSegmentationProperties( const Reference< chart2::XCha
}
}
}
catch( uno::Exception & ex )
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
OSL_FAIL( rtl::OUStringToOString(
@ -2573,7 +2572,7 @@ void ChartExport::exportDataPoints(
xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
xSeries, nElement, getModel() );
}
catch( uno::Exception & rEx )
catch( const uno::Exception & rEx )
{
(void)rEx; // avoid warning for pro build
OSL_TRACE( "Exception caught during Export of data point: %s",

View File

@ -335,7 +335,7 @@ void SAL_CALL OHierarchyElement_Impl::commited( const ::com::sun::star::lang::Ev
{
Commit();
}
catch( uno::Exception& e )
catch( const uno::Exception& e )
{
throw lang::WrappedTargetRuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not commit storage sequence!" ) ),

View File

@ -4843,13 +4843,13 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam
try {
m_pImpl->ReadContents();
}
catch ( uno::RuntimeException& aRuntimeException )
catch ( const uno::RuntimeException& aRuntimeException )
{
m_pImpl->AddLog( aRuntimeException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
catch ( uno::Exception& aException )
catch ( const uno::Exception& aException )
{
m_pImpl->AddLog( aException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
@ -4867,20 +4867,20 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam
xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ),
uno::makeAny( aAlgorithms ) );
}
catch ( uno::RuntimeException& aRuntimeException )
catch ( const uno::RuntimeException& aRuntimeException )
{
m_pImpl->AddLog( aRuntimeException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
catch( lang::IllegalArgumentException& aIAException )
catch( const lang::IllegalArgumentException& aIAException )
{
m_pImpl->AddLog( aIAException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
catch( uno::Exception& aException )
catch( const uno::Exception& aException )
{
m_pImpl->AddLog( aException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
@ -4914,13 +4914,13 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms()
try {
m_pImpl->ReadContents();
}
catch ( uno::RuntimeException& aRuntimeException )
catch ( const uno::RuntimeException& aRuntimeException )
{
m_pImpl->AddLog( aRuntimeException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
catch ( uno::Exception& aException )
catch ( const uno::Exception& aException )
{
m_pImpl->AddLog( aException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
@ -4937,13 +4937,13 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms()
{
xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) ) >>= aResult;
}
catch ( uno::RuntimeException& aRuntimeException )
catch ( const uno::RuntimeException& aRuntimeException )
{
m_pImpl->AddLog( aRuntimeException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
catch( uno::Exception& aException )
catch( const uno::Exception& aException )
{
m_pImpl->AddLog( aException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );

View File

@ -1025,7 +1025,7 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
aZipOut.write( aType, 0, nBufferLength );
aZipOut.closeEntry();
}
catch ( ::com::sun::star::io::IOException & r )
catch ( const ::com::sun::star::io::IOException & r )
{
throw WrappedTargetException(
OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Error adding mimetype to the ZipOutputStream!" ) ),
@ -1419,7 +1419,7 @@ void SAL_CALL ZipPackage::commitChanges()
{
xTempSeek->seek( 0 );
}
catch( uno::Exception& r )
catch( const uno::Exception& r )
{
throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Temporary file should be seekable!" ) ),
static_cast < OWeakObject * > ( this ), makeAny ( r ) );
@ -1444,7 +1444,7 @@ void SAL_CALL ZipPackage::commitChanges()
// after successful truncation the original file contents are already lost
xTruncate->truncate();
}
catch( uno::Exception& r )
catch( const uno::Exception& r )
{
throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is read only!" ) ),
static_cast < OWeakObject * > ( this ), makeAny ( r ) );
@ -1543,7 +1543,7 @@ void SAL_CALL ZipPackage::commitChanges()
// if the file is still not corrupted, it can become after the next step
aContent.executeCommand ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "transfer" ) ), aAny );
}
catch ( ::com::sun::star::uno::Exception& r )
catch ( const ::com::sun::star::uno::Exception& r )
{
if ( bCanBeCorrupted )
DisconnectFromTargetAndThrowException_Impl( xTempInStream );

View File

@ -103,7 +103,7 @@ int MyApp::Main()
if( xFactory.is() )
setProcessServiceFactory( xFactory );
}
catch( com::sun::star::uno::Exception& rExc)
catch( const com::sun::star::uno::Exception& )
{
}

View File

@ -387,19 +387,19 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args )
}
ret = PyRef( PyObject_CallObject( callable.get(), paras.get() ), SAL_NO_ACQUIRE );
}
catch (::com::sun::star::lang::IllegalArgumentException &e)
catch (const ::com::sun::star::lang::IllegalArgumentException &e)
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch (::com::sun::star::script::CannotConvertException &e)
catch (const ::com::sun::star::script::CannotConvertException &e)
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch (::com::sun::star::uno::RuntimeException &e)
catch (const ::com::sun::star::uno::RuntimeException &e)
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch (::com::sun::star::uno::Exception &e)
catch (const ::com::sun::star::uno::Exception &e)
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
@ -524,23 +524,23 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
//or else...
PyErr_SetString (PyExc_AttributeError, name);
}
catch( com::sun::star::reflection::InvocationTargetException & e )
catch( const com::sun::star::reflection::InvocationTargetException & e )
{
raisePyExceptionWithAny( makeAny(e.TargetException) );
}
catch( com::sun::star::beans::UnknownPropertyException & e )
catch( const com::sun::star::beans::UnknownPropertyException & e )
{
raisePyExceptionWithAny( makeAny(e) );
}
catch( com::sun::star::lang::IllegalArgumentException &e )
catch( const com::sun::star::lang::IllegalArgumentException &e )
{
raisePyExceptionWithAny( makeAny(e) );
}
catch( com::sun::star::script::CannotConvertException &e )
catch( const com::sun::star::script::CannotConvertException &e )
{
raisePyExceptionWithAny( makeAny(e) );
}
catch( RuntimeException &e )
catch( const RuntimeException &e )
{
raisePyExceptionWithAny( makeAny(e) );
}
@ -568,22 +568,22 @@ int PyUNO_setattr (PyObject* self, char* name, PyObject* value)
}
}
}
catch( com::sun::star::reflection::InvocationTargetException & e )
catch( const com::sun::star::reflection::InvocationTargetException & e )
{
raisePyExceptionWithAny( makeAny(e.TargetException) );
return 1;
}
catch( com::sun::star::beans::UnknownPropertyException & e )
catch( const com::sun::star::beans::UnknownPropertyException & e )
{
raisePyExceptionWithAny( makeAny(e) );
return 1;
}
catch( com::sun::star::script::CannotConvertException &e )
catch( const com::sun::star::script::CannotConvertException &e )
{
raisePyExceptionWithAny( makeAny(e) );
return 1;
}
catch( RuntimeException & e )
catch( const RuntimeException & e )
{
raisePyExceptionWithAny( makeAny( e ) );
return 1;
@ -637,7 +637,7 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op )
}
}
}
catch( com::sun::star::uno::RuntimeException & e)
catch( const com::sun::star::uno::RuntimeException & e)
{
raisePyExceptionWithAny( makeAny( e ) );
}

View File

@ -321,7 +321,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
}
catch(InvocationTargetException & e )
catch( const InvocationTargetException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
@ -332,7 +332,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
throw;
}
catch( RuntimeException & e )
catch( const RuntimeException & e )
{
if( cargo && isLog( cargo, LogLevel::CALL ) )
{
@ -342,7 +342,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
throw;
}
catch( CannotConvertException & e )
catch( const CannotConvertException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
@ -352,7 +352,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
throw;
}
catch( IllegalArgumentException & e )
catch( const IllegalArgumentException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
@ -387,7 +387,7 @@ void Adapter::setValue( const OUString & aPropertyName, const Any & value )
raiseInvocationTargetExceptionWhenNeeded( runtime);
}
catch( IllegalArgumentException & exc )
catch( const IllegalArgumentException & exc )
{
throw InvocationTargetException( exc.Message, *this, com::sun::star::uno::makeAny( exc ) );
}

View File

@ -152,7 +152,7 @@ PyObject* PyUNO_callable_call (PyObject* self, PyObject* args, PyObject*)
ret = temp;
}
}
catch( com::sun::star::reflection::InvocationTargetException & e )
catch( const com::sun::star::reflection::InvocationTargetException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
@ -162,7 +162,7 @@ PyObject* PyUNO_callable_call (PyObject* self, PyObject* args, PyObject*)
}
raisePyExceptionWithAny( e.TargetException );
}
catch( com::sun::star::script::CannotConvertException &e )
catch( const com::sun::star::script::CannotConvertException &e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
@ -171,7 +171,7 @@ PyObject* PyUNO_callable_call (PyObject* self, PyObject* args, PyObject*)
}
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch( com::sun::star::lang::IllegalArgumentException &e )
catch( const com::sun::star::lang::IllegalArgumentException &e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
@ -180,7 +180,7 @@ PyObject* PyUNO_callable_call (PyObject* self, PyObject* args, PyObject*)
}
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch (::com::sun::star::uno::RuntimeException &e)
catch (const ::com::sun::star::uno::RuntimeException &e)
{
if( cargo && isLog( cargo, LogLevel::CALL ) )
{

View File

@ -72,17 +72,17 @@ void raisePyExceptionWithAny( const com::sun::star::uno::Any &anyExc )
OUStringToOString(buf.makeStringAndClear(),RTL_TEXTENCODING_ASCII_US).getStr() );
}
}
catch( com::sun::star::lang::IllegalArgumentException & e)
catch(const com::sun::star::lang::IllegalArgumentException & e)
{
PyErr_SetString( PyExc_SystemError,
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US).getStr() );
}
catch( com::sun::star::script::CannotConvertException & e)
catch(const com::sun::star::script::CannotConvertException & e)
{
PyErr_SetString( PyExc_SystemError,
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US).getStr() );
}
catch( RuntimeException & e)
catch(const RuntimeException & e)
{
PyErr_SetString( PyExc_SystemError,
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US).getStr() );

View File

@ -87,7 +87,7 @@ void GCThread::run()
Py_XDECREF( mPyObject );
}
}
catch( com::sun::star::uno::RuntimeException & e )
catch( const com::sun::star::uno::RuntimeException & e )
{
rtl::OString msg;
msg = rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US );

View File

@ -306,26 +306,26 @@ static PyObject* getComponentContext (PyObject*, PyObject*)
Runtime runtime;
ret = runtime.any2PyObject( makeAny( ctx ) );
}
catch (com::sun::star::registry::InvalidRegistryException &e)
catch (const com::sun::star::registry::InvalidRegistryException &e)
{
// can't use raisePyExceptionWithAny() here, because the function
// does any conversions, which will not work with a
// wrongly bootstrapped pyuno!
raisePySystemException( "InvalidRegistryException", e.Message );
}
catch( com::sun::star::lang::IllegalArgumentException & e)
catch(const com::sun::star::lang::IllegalArgumentException & e)
{
raisePySystemException( "IllegalArgumentException", e.Message );
}
catch( com::sun::star::script::CannotConvertException & e)
catch(const com::sun::star::script::CannotConvertException & e)
{
raisePySystemException( "CannotConvertException", e.Message );
}
catch (com::sun::star::uno::RuntimeException & e)
catch (const com::sun::star::uno::RuntimeException & e)
{
raisePySystemException( "RuntimeException", e.Message );
}
catch (com::sun::star::uno::Exception & e)
catch (const com::sun::star::uno::Exception & e)
{
raisePySystemException( "uno::Exception", e.Message );
}
@ -424,15 +424,15 @@ static PyObject *createUnoStructHelper(PyObject *, PyObject* args, PyObject* key
PyErr_SetString (PyExc_AttributeError, "pyuno._createUnoStructHelper: expects exactly two non-keyword arguments:\n\tStructure Name\n\tinitialiser tuple; may be the empty tuple");
}
}
catch( com::sun::star::uno::RuntimeException & e )
catch( const com::sun::star::uno::RuntimeException & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}
catch( com::sun::star::script::CannotConvertException & e )
catch( const com::sun::star::script::CannotConvertException & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}
catch( com::sun::star::uno::Exception & e )
catch( const com::sun::star::uno::Exception & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}
@ -465,7 +465,7 @@ static PyObject *getTypeByName( PyObject *, PyObject *args )
}
}
}
catch ( RuntimeException & e )
catch ( const RuntimeException & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}
@ -498,22 +498,22 @@ static PyObject *getConstantByName( PyObject *, PyObject *args )
ret = constant.getAcquired();
}
}
catch( NoSuchElementException & e )
catch( const NoSuchElementException & e )
{
// to the python programmer, this is a runtime exception,
// do not support tweakings with the type system
RuntimeException runExc( e.Message, Reference< XInterface > () );
raisePyExceptionWithAny( makeAny( runExc ) );
}
catch( com::sun::star::script::CannotConvertException & e)
catch(const com::sun::star::script::CannotConvertException & e)
{
raisePyExceptionWithAny( makeAny( e ) );
}
catch( com::sun::star::lang::IllegalArgumentException & e)
catch(const com::sun::star::lang::IllegalArgumentException & e)
{
raisePyExceptionWithAny( makeAny( e ) );
}
catch( RuntimeException & e )
catch( const RuntimeException & e )
{
raisePyExceptionWithAny( makeAny(e) );
}
@ -535,7 +535,7 @@ static PyObject *checkType( PyObject *, PyObject *args )
{
PyType2Type( obj );
}
catch( RuntimeException & e)
catch(const RuntimeException & e)
{
raisePyExceptionWithAny( makeAny( e ) );
return NULL;
@ -559,7 +559,7 @@ static PyObject *checkEnum( PyObject *, PyObject *args )
{
PyEnum2Enum( obj );
}
catch( RuntimeException & e)
catch(const RuntimeException & e)
{
raisePyExceptionWithAny( makeAny( e) );
return NULL;
@ -583,7 +583,7 @@ static PyObject *getClass( PyObject *, PyObject *args )
Py_XINCREF( ret.get() );
return ret.get();
}
catch( RuntimeException & e)
catch(const RuntimeException & e)
{
// NOOPT !!!
// gcc 3.2.3 crashes here in the regcomp test scenario
@ -616,7 +616,7 @@ static PyObject * generateUuid( PyObject *, PyObject * )
Runtime runtime;
ret = runtime.any2PyObject( makeAny( seq ) );
}
catch( RuntimeException & e )
catch( const RuntimeException & e )
{
raisePyExceptionWithAny( makeAny(e) );
}
@ -753,7 +753,7 @@ static PyObject *getCurrentContext( PyObject *, PyObject * )
ret = runtime.any2PyObject(
makeAny( com::sun::star::uno::getCurrentContext() ) );
}
catch( com::sun::star::uno::Exception & e )
catch( const com::sun::star::uno::Exception & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}
@ -794,7 +794,7 @@ static PyObject *setCurrentContext( PyObject *, PyObject * args )
PyExc_RuntimeError, buf.makeStringAndClear().getStr() );
}
}
catch( com::sun::star::uno::Exception & e )
catch( const com::sun::star::uno::Exception & e )
{
raisePyExceptionWithAny( makeAny( e ) );
}

View File

@ -844,7 +844,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
{
a = getImpl()->cargo->xTypeConverter->convertTo( a, t );
}
catch( com::sun::star::uno::Exception & e )
catch( const com::sun::star::uno::Exception & e )
{
throw RuntimeException( e.Message, e.Context );
}
@ -930,7 +930,7 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
{
unoModule = impl->cargo->getUnoModule();
}
catch (Exception ei)
catch (const Exception &ei)
{
e=ei;
}

View File

@ -348,15 +348,15 @@ PyObject *importToGlobal(PyObject *str, PyObject *dict, PyObject *target)
PyExc_RuntimeError,
OUStringToOString( buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US).getStr() );
}
catch( com::sun::star::script::CannotConvertException & e )
catch( const com::sun::star::script::CannotConvertException & e )
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch( com::sun::star::lang::IllegalArgumentException & e )
catch( const com::sun::star::lang::IllegalArgumentException & e )
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ) );
}
catch( RuntimeException &e )
catch( const RuntimeException &e )
{
raisePyExceptionWithAny( com::sun::star::uno::makeAny( e ));
}