diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-23 12:03:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-23 15:06:00 +0200 |
commit | e7bc3cab019fbf040f9fb8b53ae2cf3f977d200b (patch) | |
tree | bc507bccee9fb71134e362b72d22991561e32aa0 /ucb/source | |
parent | c5d47c327a57df55fa3dac0fff6b65888d0345e4 (diff) |
remove boilerplate in UNO Exception constructor calls
Now that we have default values for Exception constructor params,
remove lots of boilerplate code.
Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/file/bc.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/file/filcmd.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/file/filglob.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/file/filinpstr.cxx | 12 | ||||
-rw-r--r-- | ucb/source/ucp/file/filprp.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/file/filrset.cxx | 18 | ||||
-rw-r--r-- | ucb/source/ucp/file/filstr.cxx | 18 | ||||
-rw-r--r-- | ucb/source/ucp/file/filtask.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/file/prov.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/file/shell.cxx | 16 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_storage.cxx | 12 |
11 files changed, 47 insertions, 55 deletions
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index baa5cf920583..6faafb969f0d 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -598,7 +598,7 @@ BaseContent::removeProperty( { if( m_nState & Deleted ) - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); m_pMyShell->deassociate( m_aUncPath, Name ); } @@ -744,7 +744,7 @@ BaseContent::setParent( throw( lang::NoSupportException, RuntimeException, std::exception) { - throw lang::NoSupportException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw lang::NoSupportException( THROW_WHERE ); } @@ -925,7 +925,7 @@ BaseContent::setPropertyValues( OUString NewTitle; if( !( Values[i].Value >>= NewTitle ) ) { - ret[i] <<= beans::IllegalTypeException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + ret[i] <<= beans::IllegalTypeException( THROW_WHERE ); break; } else if( NewTitle.isEmpty() ) diff --git a/ucb/source/ucp/file/filcmd.cxx b/ucb/source/ucp/file/filcmd.cxx index 0c7756b7f268..95be18aa33dd 100644 --- a/ucb/source/ucp/file/filcmd.cxx +++ b/ucb/source/ucp/file/filcmd.cxx @@ -91,7 +91,7 @@ XCommandInfo_impl::getCommandInfoByName( if( m_pMyShell->m_sCommandInfo[i].Name == aName ) return m_pMyShell->m_sCommandInfo[i]; - throw UnsupportedCommandException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw UnsupportedCommandException( THROW_WHERE ); } @@ -105,7 +105,7 @@ XCommandInfo_impl::getCommandInfoByHandle( if( m_pMyShell->m_sCommandInfo[i].Handle == Handle ) return m_pMyShell->m_sCommandInfo[i]; - throw UnsupportedCommandException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw UnsupportedCommandException( THROW_WHERE ); } diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index c0bd6f915feb..ea12bf72d97f 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -252,7 +252,7 @@ namespace fileaccess { if( errorCode == TASKHANDLER_UNSUPPORTED_COMMAND ) { - aAny <<= UnsupportedCommandException( OUString( OSL_LOG_PREFIX ), uno::Reference< uno::XInterface >() ); + aAny <<= UnsupportedCommandException( OSL_LOG_PREFIX ); cancelCommandExecution( aAny,xEnv ); } else if( errorCode == TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT || diff --git a/ucb/source/ucp/file/filinpstr.cxx b/ucb/source/ucp/file/filinpstr.cxx index 7f71b3719c00..bb5bf134cdc1 100644 --- a/ucb/source/ucp/file/filinpstr.cxx +++ b/ucb/source/ucp/file/filinpstr.cxx @@ -139,7 +139,7 @@ XInputStream_impl::readBytes( io::IOException, uno::RuntimeException, std::exception) { - if( ! m_nIsOpen ) throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + if( ! m_nIsOpen ) throw io::IOException( THROW_WHERE ); aData.realloc(nBytesToRead); //TODO! translate memory exhaustion (if it were detectable...) into @@ -148,7 +148,7 @@ XInputStream_impl::readBytes( sal_uInt64 nrc(0); if(m_aFile.read( aData.getArray(),sal_uInt64(nBytesToRead),nrc ) != osl::FileBase::E_None) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); // Shrink aData in case we read less than nBytesToRead (XInputStream // documentation does not tell whether this is required, and I do not know @@ -205,7 +205,7 @@ XInputStream_impl::closeInput( { osl::FileBase::RC err = m_aFile.close(); if( err != osl::FileBase::E_None ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); m_nIsOpen = false; } } @@ -221,7 +221,7 @@ XInputStream_impl::seek( if( location < 0 ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); if( osl::FileBase::E_None != m_aFile.setPos( osl_Pos_Absolut, sal_uInt64( location ) ) ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); } @@ -233,7 +233,7 @@ XInputStream_impl::getPosition( { sal_uInt64 uPos; if( osl::FileBase::E_None != m_aFile.getPos( uPos ) ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); return sal_Int64( uPos ); } @@ -245,7 +245,7 @@ XInputStream_impl::getLength( { sal_uInt64 uEndPos; if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); else return sal_Int64( uEndPos ); } diff --git a/ucb/source/ucp/file/filprp.cxx b/ucb/source/ucp/file/filprp.cxx index 605768fdc429..9bf21571f587 100644 --- a/ucb/source/ucp/file/filprp.cxx +++ b/ucb/source/ucp/file/filprp.cxx @@ -84,7 +84,7 @@ XPropertySetInfo_impl::getPropertyByName( for( sal_Int32 i = 0; i < m_seq.getLength(); ++i ) if( m_seq[i].Name == aName ) return m_seq[i]; - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); } diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index c2bb51cabdce..a7a60606a01e 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -603,7 +603,7 @@ XResultSet_impl::getStaticResultSet() osl::MutexGuard aGuard( m_aMutex ); if ( m_xListener.is() ) - throw ucb::ListenerAlreadySetException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw ucb::ListenerAlreadySetException( THROW_WHERE ); return uno::Reference< sdbc::XResultSet >( this ); } @@ -619,7 +619,7 @@ XResultSet_impl::setListener( osl::ClearableMutexGuard aGuard( m_aMutex ); if ( m_xListener.is() ) - throw ucb::ListenerAlreadySetException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw ucb::ListenerAlreadySetException( THROW_WHERE ); m_xListener = Listener; @@ -659,9 +659,9 @@ XResultSet_impl::connectToCache( uno::RuntimeException, std::exception ) { if( m_xListener.is() ) - throw ucb::ListenerAlreadySetException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw ucb::ListenerAlreadySetException( THROW_WHERE ); if( m_bStatic ) - throw ucb::ListenerAlreadySetException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw ucb::ListenerAlreadySetException( THROW_WHERE ); uno::Reference< ucb::XSourceInitialization > xTarget( xCache, uno::UNO_QUERY ); @@ -685,7 +685,7 @@ XResultSet_impl::connectToCache( return; } } - throw ucb::ServiceNotFoundException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw ucb::ServiceNotFoundException( THROW_WHERE ); } @@ -769,7 +769,7 @@ void SAL_CALL XResultSet_impl::setPropertyValue( if( aPropertyName == "IsRowCountFinal" || aPropertyName == "RowCount" ) return; - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); } @@ -793,7 +793,7 @@ uno::Any SAL_CALL XResultSet_impl::getPropertyValue( return aAny; } else - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); } @@ -822,7 +822,7 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener( m_pRowCountListeners->addInterface( xListener ); } else - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); } @@ -847,7 +847,7 @@ void SAL_CALL XResultSet_impl::removePropertyChangeListener( m_pRowCountListeners->removeInterface( aListener ); } else - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); } void SAL_CALL XResultSet_impl::addVetoableChangeListener( diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx index fd48c384b54b..7ee9408919d7 100644 --- a/ucb/source/ucp/file/filstr.cxx +++ b/ucb/source/ucp/file/filstr.cxx @@ -126,10 +126,10 @@ void SAL_CALL XStream_impl::truncate(void) throw( io::IOException, uno::RuntimeException, std::exception ) { if (osl::FileBase::E_None != m_aFile.setSize(0)) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); if (osl::FileBase::E_None != m_aFile.setPos(osl_Pos_Absolut,sal_uInt64(0))) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); } @@ -148,7 +148,7 @@ XStream_impl::readBytes( uno::RuntimeException, std::exception) { if( ! m_nIsOpen ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); sal_Int8 * buffer; try @@ -158,7 +158,7 @@ XStream_impl::readBytes( catch (const std::bad_alloc&) { if( m_nIsOpen ) m_aFile.close(); - throw io::BufferSizeExceededException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::BufferSizeExceededException( THROW_WHERE ); } sal_uInt64 nrc(0); @@ -166,7 +166,7 @@ XStream_impl::readBytes( != osl::FileBase::E_None) { delete[] buffer; - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); } aData = uno::Sequence< sal_Int8 > ( buffer, (sal_uInt32)nrc ); delete[] buffer; @@ -224,7 +224,7 @@ XStream_impl::writeBytes( const uno::Sequence< sal_Int8 >& aData ) const sal_Int8* p = aData.getConstArray(); if(osl::FileBase::E_None != m_aFile.write(((void*)(p)),sal_uInt64(length),nWrittenBytes) || nWrittenBytes != length ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); } } @@ -290,7 +290,7 @@ XStream_impl::seek( if( location < 0 ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); if( osl::FileBase::E_None != m_aFile.setPos( osl_Pos_Absolut, sal_uInt64( location ) ) ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); } @@ -302,7 +302,7 @@ XStream_impl::getPosition( { sal_uInt64 uPos; if( osl::FileBase::E_None != m_aFile.getPos( uPos ) ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); return sal_Int64( uPos ); } @@ -314,7 +314,7 @@ XStream_impl::getLength( { sal_uInt64 uEndPos; if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None ) - throw io::IOException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw io::IOException( THROW_WHERE ); else return sal_Int64( uEndPos ); } diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx index 97a690484b7e..37f96a9baaaa 100644 --- a/ucb/source/ucp/file/filtask.cxx +++ b/ucb/source/ucp/file/filtask.cxx @@ -57,9 +57,7 @@ TaskManager::startTask( TaskMap::iterator it = m_aTaskMap.find( CommandId ); if( it != m_aTaskMap.end() ) { - throw DuplicateCommandIdentifierException( - OUString( OSL_LOG_PREFIX ), - uno::Reference< uno::XInterface >() ); + throw DuplicateCommandIdentifierException( OSL_LOG_PREFIX ); } m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv ); } diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index be3fc1155872..95400bdc577a 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -205,7 +205,7 @@ FileProvider::queryContent( aUnc ); if( err ) - throw IllegalIdentifierException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw IllegalIdentifierException( THROW_WHERE ); return Reference< XContent >( new BaseContent( m_pMyShell,xIdentifier,aUnc ) ); } @@ -396,7 +396,7 @@ XPropertySetInfoImpl2::getPropertyByName( if( m_seq[i].Name == aName ) return m_seq[i]; - throw UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw UnknownPropertyException( THROW_WHERE ); } @@ -478,7 +478,7 @@ FileProvider::setPropertyValue( const OUString& aPropertyName, aPropertyName.equalsAscii( "HostName" ) ) return; else - throw UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw UnknownPropertyException( THROW_WHERE ); } @@ -510,7 +510,7 @@ FileProvider::getPropertyValue( return aAny; } else - throw UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw UnknownPropertyException( THROW_WHERE ); } diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 054b47c5e062..c07e97d49be8 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -482,7 +482,7 @@ shell::associate( const OUString& aUnqPath, shell::PropertySet::iterator it1 = m_aDefaultProperties.find( newProperty ); if( it1 != m_aDefaultProperties.end() ) - throw beans::PropertyExistException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::PropertyExistException( THROW_WHERE ); { osl::MutexGuard aGuard( m_aMutex ); @@ -495,7 +495,7 @@ shell::associate( const OUString& aUnqPath, PropertySet& properties = *(it->second.properties); it1 = properties.find( newProperty ); if( it1 != properties.end() ) - throw beans::PropertyExistException(THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::PropertyExistException(THROW_WHERE ); // Property does not exist properties.insert( newProperty ); @@ -518,7 +518,7 @@ shell::deassociate( const OUString& aUnqPath, shell::PropertySet::iterator it1 = m_aDefaultProperties.find( oldProperty ); if( it1 != m_aDefaultProperties.end() ) - throw beans::NotRemoveableException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::NotRemoveableException( THROW_WHERE ); osl::MutexGuard aGuard( m_aMutex ); @@ -530,7 +530,7 @@ shell::deassociate( const OUString& aUnqPath, it1 = properties.find( oldProperty ); if( it1 == properties.end() ) - throw beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + throw beans::UnknownPropertyException( THROW_WHERE ); properties.erase( it1 ); @@ -826,7 +826,7 @@ shell::setv( const OUString& aUnqPath, it1 = properties.find( toset ); if( it1 == properties.end() ) { - ret[i] <<= beans::UnknownPropertyException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + ret[i] <<= beans::UnknownPropertyException( THROW_WHERE ); continue; } @@ -836,7 +836,7 @@ shell::setv( const OUString& aUnqPath, if( it1->getAttributes() & beans::PropertyAttribute::READONLY ) { - ret[i] <<= lang::IllegalAccessException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + ret[i] <<= lang::IllegalAccessException( THROW_WHERE ); continue; } @@ -907,7 +907,7 @@ shell::setv( const OUString& aUnqPath, } } else - ret[i] <<= beans::IllegalTypeException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + ret[i] <<= beans::IllegalTypeException( THROW_WHERE ); } else if(values[i].Name == IsReadOnly || values[i].Name == IsHidden) @@ -1015,7 +1015,7 @@ shell::setv( const OUString& aUnqPath, } } else - ret[i] <<= beans::IllegalTypeException( THROW_WHERE, uno::Reference< uno::XInterface >() ); + ret[i] <<= beans::IllegalTypeException( THROW_WHERE ); } } } // end for diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx index ff7907eafce1..a0356bf1a6a0 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.cxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx @@ -446,9 +446,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( { // document opened, but not readable. throw embed::InvalidStorageException( - OUString( - "Storage is open, but not readable!" ), - uno::Reference< uno::XInterface >() ); + "Storage is open, but not readable!" ); } // storage okay break; @@ -459,9 +457,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( { // document opened, but not writable. throw embed::InvalidStorageException( - OUString( - "Storage is open, but not writable!" ), - uno::Reference< uno::XInterface >() ); + "Storage is open, but not writable!" ); } // storage okay break; @@ -473,9 +469,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( "Bug! Value of property OpenMode has wrong type!" ); throw uno::RuntimeException( - OUString( - "Bug! Value of property OpenMode has wrong type!" ), - uno::Reference< uno::XInterface >() ); + "Bug! Value of property OpenMode has wrong type!" ); } } catch ( beans::UnknownPropertyException const & e ) |