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
This commit is contained in:
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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 )
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user