From 83b022808acccc4e401ff93d8cd6b49f2ca2864c Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 5 Sep 2014 10:07:56 +0200 Subject: [PATCH] coverity: fix mismatching exceptions --- 0001-fix-mismatching-exceptions.patch | 107 ++++++++++++++++++++++++++ libcmis.spec | 6 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 0001-fix-mismatching-exceptions.patch diff --git a/0001-fix-mismatching-exceptions.patch b/0001-fix-mismatching-exceptions.patch new file mode 100644 index 0000000..a1845ba --- /dev/null +++ b/0001-fix-mismatching-exceptions.patch @@ -0,0 +1,107 @@ +From 043561716b1c7c23c1576631c5bdca93e6e9ffe5 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Fri, 5 Sep 2014 09:53:50 +0200 +Subject: [PATCH] fix mismatching exceptions + +--- + src/libcmis/base-session.cxx | 56 +++++++++++++++++++++++++++++++++++--------- + 1 file changed, 45 insertions(+), 11 deletions(-) + +diff --git a/src/libcmis/base-session.cxx b/src/libcmis/base-session.cxx +index 7f6a413..80c53e4 100644 +--- a/src/libcmis/base-session.cxx ++++ b/src/libcmis/base-session.cxx +@@ -287,8 +287,15 @@ libcmis::HttpResponsePtr BaseSession::httpGetRequest( string url ) throw ( CurlE + // Need to use the refresh token to get a new one. + if ( getHttpStatus( ) == 401 && !getRefreshToken( ).empty( ) && !m_refreshedToken ) + { +- // Refresh the token +- m_oauth2Handler->refresh( ); ++ try ++ { ++ // Refresh the token ++ m_oauth2Handler->refresh( ); ++ } ++ catch ( const libcmis::Exception& e ) ++ { ++ throw CurlException( e.what() ); ++ } + + // Resend the query + try +@@ -370,8 +377,15 @@ libcmis::HttpResponsePtr BaseSession::httpPutRequest( string url, istream& is, v + if ( status == 401 && !getRefreshToken( ).empty( ) && !m_refreshedToken ) + { + +- // Refresh the token +- m_oauth2Handler->refresh( ); ++ try ++ { ++ // Refresh the token ++ m_oauth2Handler->refresh( ); ++ } ++ catch ( const libcmis::Exception& e ) ++ { ++ throw CurlException( e.what() ); ++ } + + // Resend the query + try +@@ -457,8 +471,15 @@ libcmis::HttpResponsePtr BaseSession::httpPostRequest( const string& url, istrea + // Need to use the refresh token to get a new one. + if ( status == 401 && !getRefreshToken( ).empty( ) && !m_refreshedToken ) + { +- // Refresh the token +- m_oauth2Handler->refresh( ); ++ try ++ { ++ // Refresh the token ++ m_oauth2Handler->refresh( ); ++ } ++ catch ( const libcmis::Exception& e ) ++ { ++ throw CurlException( e.what() ); ++ } + + // Resend the query + try +@@ -501,9 +522,16 @@ void BaseSession::httpDeleteRequest( string url ) throw ( CurlException ) + // Need to use the refresh token to get a new one. + if ( getHttpStatus( ) == 401 && !getRefreshToken( ).empty( ) && !m_refreshedToken ) + { +- +- // Refresh the token +- m_oauth2Handler->refresh( ); ++ try ++ { ++ // Refresh the token ++ m_oauth2Handler->refresh( ); ++ } ++ catch ( const libcmis::Exception& e ) ++ { ++ throw CurlException( e.what() ); ++ } ++ + // Resend the query + try + { +@@ -722,8 +750,14 @@ void BaseSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ) throw ( libcmis + + // Try to get the authentication code using the given provider. + +- authCode = m_oauth2Handler->oauth2Authenticate( ); +- ++ try ++ { ++ authCode = m_oauth2Handler->oauth2Authenticate( ); ++ } ++ catch ( const CurlException& e ) ++ { ++ throw e.getCmisException( ); ++ } + + // If that didn't work, call the fallback provider from SessionFactory + try +-- +1.9.3 + diff --git a/libcmis.spec b/libcmis.spec index 5778d4b..aa59d99 100644 --- a/libcmis.spec +++ b/libcmis.spec @@ -2,7 +2,7 @@ Name: libcmis Version: 0.4.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A C++ client library for CM interfaces Group: System Environment/Libraries @@ -18,6 +18,7 @@ BuildRequires: xmlto Patch0: 0001-Fix-int-bool-confusion-on-big-endian-architectures.patch Patch1: 0001-coverity-return-const-string.patch +Patch2: 0001-fix-mismatching-exceptions.patch %description LibCMIS is a C++ client library for working with CM (content management) @@ -86,6 +87,9 @@ make check %{_mandir}/man1/cmis-client.1* %changelog +* Fri Sep 05 2014 David Tardon - 0.4.1-8 +- coverity: fix mismatching exceptions + * Thu Sep 04 2014 David Tardon - 0.4.1-7 - a few use-after-free fixes for the C wrapper