connectivity/source/commontools/dbexception.cxx | 4 ++-- connectivity/source/drivers/dbase/DTable.cxx | 7 ++++--- connectivity/source/drivers/jdbc/JConnection.cxx | 4 +++- connectivity/source/drivers/jdbc/ResultSet.cxx | 7 +++++-- dbaccess/source/core/api/RowSet.cxx | 12 +++++++----- include/connectivity/dbexception.hxx | 3 ++- 6 files changed, 23 insertions(+), 14 deletions(-)
New commits: commit 20c4c3acd5fbf38f2e990435bf346d4fbac05f9d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Feb 5 15:48:53 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Feb 6 08:16:38 2019 +0100 store originating exception when re-throwing Change-Id: I26959d3604a581f1528e575239970ab364c7fd50 Reviewed-on: https://gerrit.libreoffice.org/67413 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index 718bbdf4d674..31503a724a01 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -400,7 +400,7 @@ void throwGenericSQLException(const OUString& _rMsg, const Reference< XInterface throw SQLException( _rMsg, _rxSource, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 0, _rNextException); } -void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, const Reference< XInterface >& _rxContext ) +void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, const Reference< XInterface >& _rxContext, const Any& _rNextException ) { ::connectivity::SharedResources aResources; const OUString sError( aResources.getResourceStringWithSubstitution( @@ -413,7 +413,7 @@ void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, cons _rxContext, getStandardSQLState( StandardSQLState::FEATURE_NOT_IMPLEMENTED ), 0, - Any() + _rNextException ); } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 735daf3bc1ab..767f4d99ac99 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -1068,12 +1068,12 @@ bool ODbaseTable::CreateImpl() } catch(const Exception&) { - + css::uno::Any anyEx = cppu::getCaughtException(); const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_COULD_NOT_DELETE_FILE, "$name$", aName ) ); - ::dbtools::throwGenericSQLException( sError, *this ); + ::dbtools::throwGenericSQLException( sError, *this, anyEx ); } } if (!CreateMemoFile(aURL)) @@ -1086,11 +1086,12 @@ bool ODbaseTable::CreateImpl() } catch(const ContentCreationException&) { + css::uno::Any anyEx = cppu::getCaughtException(); const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_COULD_NOT_DELETE_FILE, "$name$", aName ) ); - ::dbtools::throwGenericSQLException( sError, *this ); + ::dbtools::throwGenericSQLException( sError, *this, anyEx ); } return false; } diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 8d0dfe141b54..2a1b153b9fd6 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -701,9 +701,11 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas } catch( Exception& ) { + css::uno::Any anyEx = cppu::getCaughtException(); ::dbtools::throwGenericSQLException( lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ), - *this + *this, + anyEx ); } } diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 97b1f1233e50..238e78702c61 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -35,6 +35,7 @@ #include <comphelper/property.hxx> #include <connectivity/CommonTools.hxx> #include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <comphelper/sequence.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <TConnection.hxx> @@ -729,7 +730,8 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con } catch(const Exception&) { - ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateBinaryStream", *this ); + Any anyEx = ::cppu::getCaughtException(); + ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateBinaryStream", *this, anyEx ); } } @@ -760,7 +762,8 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, } catch(const Exception&) { - ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateCharacterStream", *this ); + Any anyEx = ::cppu::getCaughtException(); + ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateCharacterStream", *this, anyEx ); } } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 349d70716b7b..f390467422f2 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2214,7 +2214,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH Any aError = ::cppu::getCaughtException(); OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE, "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) ); - ::dbtools::throwGenericSQLException( sMessage, *this ); + ::dbtools::throwGenericSQLException( sMessage, *this, aError ); } } setActiveConnection(xNewConn); @@ -2574,9 +2574,10 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc m_bParametersDirty = true; x->closeInput(); } - catch( Exception& ) + catch( Exception const & ) { - throw SQLException(); + css::uno::Any anyEx = cppu::getCaughtException(); + throw SQLException("ORowSet::setBinaryStream", *this, "S1000", 0,anyEx); } } @@ -2597,9 +2598,10 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer rParamValue.setTypeKind( DataType::LONGVARCHAR ); x->closeInput(); } - catch( Exception& ) + catch( Exception const & ) { - throw SQLException(); + css::uno::Any anyEx = cppu::getCaughtException(); + throw SQLException("ORowSet::setCharacterStream", *this, "S1000", 0, anyEx); } } diff --git a/include/connectivity/dbexception.hxx b/include/connectivity/dbexception.hxx index e016e7f7e1b5..729ca3cb80f0 100644 --- a/include/connectivity/dbexception.hxx +++ b/include/connectivity/dbexception.hxx @@ -272,7 +272,8 @@ OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException( */ OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, - const css::uno::Reference< css::uno::XInterface >& _rxContext + const css::uno::Reference< css::uno::XInterface >& _rxContext, + const css::uno::Any& _rNextException = css::uno::Any() ); /** throw a RuntimeException (Optional feature not implemented) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits