[libcmis/f20] coverity: fix mismatching exceptions
David Tardon
dtardon at fedoraproject.org
Fri Sep 5 08:10:54 UTC 2014
commit f8f3696a7244430432040017009779c2897bf539
Author: David Tardon <dtardon at redhat.com>
Date: Fri Sep 5 10:07:56 2014 +0200
coverity: fix mismatching exceptions
Conflicts:
libcmis.spec
0001-fix-mismatching-exceptions.patch | 107 +++++++++++++++++++++++++++++++++
libcmis.spec | 6 ++-
2 files changed, 112 insertions(+), 1 deletions(-)
---
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 <dtardon at redhat.com>
+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 7b31bab..06a06fc 100644
--- a/libcmis.spec
+++ b/libcmis.spec
@@ -2,7 +2,7 @@
Name: libcmis
Version: 0.4.1
-Release: 4%{?dist}
+Release: 5%{?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)
@@ -91,6 +92,9 @@ make check
%{_mandir}/man1/cmis-client.1*
%changelog
+* Fri Sep 05 2014 David Tardon <dtardon at redhat.com> - 0.4.1-5
+- coverity: fix mismatching exceptions
+
* Thu Sep 04 2014 David Tardon <dtardon at redhat.com> - 0.4.1-4
- a few use-after-free fixes for the C wrapper
More information about the scm-commits
mailing list