summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-25 15:51:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-25 16:56:18 +0100
commit6c8b24bf3cec9dd0cefb0b83b7fee5e1281a1232 (patch)
tree7a54d96c1d6c72213d54c398850e4fe5a39d8d24 /connectivity
parent9e965e9b15be7674a4b7b787370018fbd60e339e (diff)
coverity#706322 Uncaught exception
Change-Id: I4ebfee76cb17562a47d4c2e868539fc70ead530e
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/jdbc/InputStream.cxx4
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx11
-rw-r--r--connectivity/source/inc/java/lang/Object.hxx1
3 files changed, 13 insertions, 3 deletions
diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx
index 91dec5cd431d..b9e0d146e2f4 100644
--- a/connectivity/source/drivers/jdbc/InputStream.cxx
+++ b/connectivity/source/drivers/jdbc/InputStream.cxx
@@ -91,10 +91,10 @@ sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequen
static const char * cMethodName = "read";
// execute Java-Call
static jmethodID mID(NULL);
- obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
+ obtainMethodId_throwRuntime(t.pEnv, cMethodName,cSignature, mID);
out = t.pEnv->CallIntMethod( object, mID, pByteArray, 0, nBytesToRead );
if ( !out )
- ThrowSQLException(t.pEnv,*this);
+ ThrowRuntimeException(t.pEnv,*this);
if(out > 0)
{
jboolean p = sal_False;
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 9401eb66d6c7..80faf9e39e2a 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -20,6 +20,7 @@
#include "java/lang/Class.hxx"
#include <connectivity/CommonTools.hxx>
#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include "java/tools.hxx"
#include "java/sql/SQLException.hxx"
#include <osl/mutex.hxx>
@@ -209,7 +210,6 @@ void java_lang_Object::ThrowLoggedSQLException( const ::comphelper::ResourceBase
}
}
-
void java_lang_Object::ThrowSQLException( JNIEnv* _pEnvironment, const Reference< XInterface>& _rxContext )
{
SQLException aException;
@@ -217,6 +217,15 @@ void java_lang_Object::ThrowSQLException( JNIEnv* _pEnvironment, const Reference
throw aException;
}
+void java_lang_Object::ThrowRuntimeException( JNIEnv* _pEnvironment, const Reference< XInterface>& _rxContext )
+{
+ SQLException aException;
+ if ( lcl_translateJNIExceptionToUNOException( _pEnvironment, _rxContext, aException ) )
+ {
+ throw WrappedTargetRuntimeException(aException.Message, aException.Context, makeAny(aException));
+ }
+}
+
void java_lang_Object::obtainMethodId_throwSQL(JNIEnv* _pEnv,const char* _pMethodName, const char* _pSignature,jmethodID& _inout_MethodID) const
{
if ( !_inout_MethodID )
diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx
index 190433427624..67c362a0ac12 100644
--- a/connectivity/source/inc/java/lang/Object.hxx
+++ b/connectivity/source/inc/java/lang/Object.hxx
@@ -105,6 +105,7 @@ namespace connectivity
JNIEnv* pEnvironment,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext
);
+ static void ThrowRuntimeException(JNIEnv * pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext);
static ::rtl::Reference< jvmaccess::VirtualMachine > getVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext=NULL);