summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-10 16:13:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-10 18:14:35 +0100
commit430e19e4f9c24985f855d5e607aaef63d110ddeb (patch)
treeda501bfabfe7c5520dd350463f1e970f035371dc /ucb
parentf5c8a636a644d4b74450de29f11399f3f69f55a7 (diff)
coverity#1241375 Uncaught exception
and coverity#1241356 Uncaught exception coverity#1241415 Uncaught exception coverity#1241449 Uncaught exception coverity#1241146 Uncaught exception coverity#1241169 Uncaught exception coverity#1241408 Uncaught exception coverity#1241452 Uncaught exception coverity#1241443 Uncaught exception coverity#1241236 Uncaught exception coverity#1241157 Uncaught exception coverity#1241283 Uncaught exception coverity#1241409 Uncaught exception coverity#1241229 Uncaught exception coverity#1241387 Uncaught exception coverity#1241050 Uncaught exception coverity#1241371 Uncaught exception coverity#1241048 Uncaught exception coverity#1241112 Uncaught exception coverity#1241351 Uncaught exception coverity#1241370 Uncaught exception coverity#1241329 Uncaught exception coverity#1241162 Uncaught exception coverity#1241103 Uncaught exception coverity#1241342 Uncaught exception coverity#1241271 Uncaught exception coverity#1241219 Uncaught exception coverity#1241245 Uncaught exception Change-Id: I3418bb54b5c385110201a99a339eba0d0d3048f5
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx26
-rw-r--r--ucb/source/ucp/gio/gio_content.hxx3
-rw-r--r--ucb/source/ucp/gio/gio_inputstream.cxx4
-rw-r--r--ucb/source/ucp/gio/gio_outputstream.cxx4
-rw-r--r--ucb/source/ucp/gio/gio_seekable.cxx6
5 files changed, 36 insertions, 7 deletions
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 2f71f03d903b..96dbd72e016f 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/lang/IllegalAccessException.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
@@ -58,6 +59,7 @@
#include <com/sun/star/ucb/XContentCreator.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/interactionrequest.hxx>
@@ -283,6 +285,30 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac
return aRet;
}
+void convertToIOException(GError *pError, const uno::Reference< uno::XInterface >& rContext)
+ throw( io::IOException, uno::RuntimeException, std::exception )
+{
+ try
+ {
+ convertToException(pError, rContext);
+ }
+ catch (const io::IOException&)
+ {
+ throw;
+ }
+ catch (const uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch (const uno::Exception& e)
+ {
+ css::uno::Any a(cppu::getCaughtException());
+ throw css::lang::WrappedTargetException(
+ "wrapped Exception " + e.Message,
+ css::uno::Reference<css::uno::XInterface>(), a);
+ }
+}
+
uno::Any Content::mapGIOError( GError *pError )
{
if (!pError)
diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx
index fd40d200a234..ac42a66bd3c7 100644
--- a/ucb/source/ucp/gio/gio_content.hxx
+++ b/ucb/source/ucp/gio/gio_content.hxx
@@ -56,6 +56,9 @@ namespace gio
com::sun::star::uno::Any convertToException(GError *pError,
const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true);
+void convertToIOException(GError *pError,
+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext)
+ throw (css::io::IOException, css::uno::RuntimeException, std::exception);
class ContentProvider;
class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
diff --git a/ucb/source/ucp/gio/gio_inputstream.cxx b/ucb/source/ucp/gio/gio_inputstream.cxx
index 49b6b386b3c7..4a14f22c4b15 100644
--- a/ucb/source/ucp/gio/gio_inputstream.cxx
+++ b/ucb/source/ucp/gio/gio_inputstream.cxx
@@ -66,7 +66,7 @@ void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip )
GError *pError=NULL;
if (!g_seekable_seek(G_SEEKABLE(mpStream), nBytesToSkip, G_SEEK_CUR, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
}
sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
@@ -88,7 +88,7 @@ sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal
gsize nBytesRead = 0;
GError *pError=NULL;
if (!g_input_stream_read_all(G_INPUT_STREAM(mpStream), aData.getArray(), nBytesToRead, &nBytesRead, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
aData.realloc(nBytesRead);
return nBytesRead;
}
diff --git a/ucb/source/ucp/gio/gio_outputstream.cxx b/ucb/source/ucp/gio/gio_outputstream.cxx
index b4e4c1291392..d8cf60f9aca6 100644
--- a/ucb/source/ucp/gio/gio_outputstream.cxx
+++ b/ucb/source/ucp/gio/gio_outputstream.cxx
@@ -49,7 +49,7 @@ void SAL_CALL OutputStream::writeBytes( const com::sun::star::uno::Sequence< sal
GError *pError=NULL;
if (!g_output_stream_write_all(G_OUTPUT_STREAM(mpStream), rData.getConstArray(), rData.getLength(), NULL, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
}
void SAL_CALL OutputStream::flush( void )
@@ -61,7 +61,7 @@ void SAL_CALL OutputStream::flush( void )
GError *pError=NULL;
if (!g_output_stream_flush(G_OUTPUT_STREAM(mpStream), NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
}
void SAL_CALL OutputStream::closeOutput( void )
diff --git a/ucb/source/ucp/gio/gio_seekable.cxx b/ucb/source/ucp/gio/gio_seekable.cxx
index ba338c02f4c9..940375dbd4e9 100644
--- a/ucb/source/ucp/gio/gio_seekable.cxx
+++ b/ucb/source/ucp/gio/gio_seekable.cxx
@@ -51,7 +51,7 @@ void SAL_CALL Seekable::truncate( void )
GError *pError=NULL;
if (!g_seekable_truncate(mpStream, 0, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
}
void SAL_CALL Seekable::seek( sal_Int64 location )
@@ -66,7 +66,7 @@ void SAL_CALL Seekable::seek( sal_Int64 location )
GError *pError=NULL;
if (!g_seekable_seek(mpStream, location, G_SEEK_SET, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
}
sal_Int64 SAL_CALL Seekable::getPosition() throw( io::IOException, uno::RuntimeException, std::exception )
@@ -104,7 +104,7 @@ sal_Int64 SAL_CALL Seekable::getLength() throw( io::IOException, uno::RuntimeExc
GError *pError=NULL;
sal_Int64 nCurr = getPosition();
if (!g_seekable_seek(mpStream, 0, G_SEEK_END, NULL, &pError))
- convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+ convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
nSize = getPosition();
seek(nCurr);
bOk = true;