summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-15 10:06:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-15 16:56:56 +0100
commitb0f26546cece3b1f251c83d29560b09577bfe2f4 (patch)
tree3e2086dc0dfc9a8250007494fd86eda69e074add /connectivity
parent405a61f916ba3da4f2fa9d27ab4f0cc287eed1a6 (diff)
coverity#706322 Uncaught exception
and coverity#706330 Uncaught exception Change-Id: I105e37c88654cf47b50fe6b260b8994622305dab
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/InputStream.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx12
-rw-r--r--connectivity/source/drivers/jdbc/Reader.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/ResultSetMetaData.cxx10
-rw-r--r--connectivity/source/inc/java/lang/Object.hxx3
7 files changed, 22 insertions, 11 deletions
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 6638b55aa1c3..a915b8c95cf4 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -140,7 +140,7 @@ sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) t
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
createStatement(t.pEnv);
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getInt",mID,columnIndex);
+ return callIntMethodWithIntArg_Throw("getInt",mID,columnIndex);
}
sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, RuntimeException, std::exception)
diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx
index 41afbe887996..f1cba905e75f 100644
--- a/connectivity/source/drivers/jdbc/InputStream.cxx
+++ b/connectivity/source/drivers/jdbc/InputStream.cxx
@@ -62,7 +62,7 @@ sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Se
void SAL_CALL java_io_InputStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- callIntMethodWithIntArg("skip",mID,nBytesToSkip);
+ callIntMethodWithIntArg_Nothrow("skip",mID,nBytesToSkip);
}
sal_Int32 SAL_CALL java_io_InputStream::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception)
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 37c8a410e907..5ca638fd7b12 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -284,7 +284,7 @@ sal_Int32 java_lang_Object::callIntMethod_Nothrow(const char* _pMethodName, jmet
return (sal_Int32)out;
}
-sal_Int32 java_lang_Object::callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nArgument ) const
+sal_Int32 java_lang_Object::callIntMethodWithIntArg_Throw( const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nArgument ) const
{
SDBThreadAttach t;
OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java environment anymore!" );
@@ -292,7 +292,17 @@ sal_Int32 java_lang_Object::callIntMethodWithIntArg( const char* _pMethodName, j
// call method
jint out( t.pEnv->CallIntMethod( object, _inout_MethodID , _nArgument) );
ThrowSQLException( t.pEnv, NULL );
+ return (sal_Int32)out;
+}
+sal_Int32 java_lang_Object::callIntMethodWithIntArg_Nothrow( const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nArgument ) const
+{
+ SDBThreadAttach t;
+ OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java environment anymore!" );
+ obtainMethodId(t.pEnv, _pMethodName,"(I)I", _inout_MethodID);
+ // call method
+ jint out( t.pEnv->CallIntMethod( object, _inout_MethodID , _nArgument) );
+ isExceptionOccurred(t.pEnv,true);
return (sal_Int32)out;
}
diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx
index 3907da727d48..b62da3a64781 100644
--- a/connectivity/source/drivers/jdbc/Reader.cxx
+++ b/connectivity/source/drivers/jdbc/Reader.cxx
@@ -52,7 +52,7 @@ sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequenc
void SAL_CALL java_io_Reader::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- callIntMethodWithIntArg("skip",mID,nBytesToSkip);
+ callIntMethodWithIntArg_Nothrow("skip",mID,nBytesToSkip);
}
sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception)
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 279f94459836..0f20a75b542c 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -217,7 +217,7 @@ float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLEx
sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getInt",mID,columnIndex);
+ return callIntMethodWithIntArg_Throw("getInt",mID,columnIndex);
}
diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
index 91c548a3c7dd..6dcd5da2f982 100644
--- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
@@ -58,14 +58,14 @@ jclass java_sql_ResultSetMetaData::getMyClass() const
sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
+ return callIntMethodWithIntArg_Throw("getColumnDisplaySize",mID,column);
}
sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getColumnType",mID,column);
+ return callIntMethodWithIntArg_Throw("getColumnType",mID,column);
}
@@ -157,19 +157,19 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw
sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getPrecision",mID,column);
+ return callIntMethodWithIntArg_Throw("getPrecision",mID,column);
}
sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getScale",mID,column);
+ return callIntMethodWithIntArg_Throw("getScale",mID,column);
}
sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
{
static jmethodID mID(NULL);
- return callIntMethodWithIntArg("isNullable",mID,column);
+ return callIntMethodWithIntArg_Throw("isNullable",mID,column);
}
diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx
index cf46e5853d47..28b4e438490d 100644
--- a/connectivity/source/inc/java/lang/Object.hxx
+++ b/connectivity/source/inc/java/lang/Object.hxx
@@ -116,7 +116,8 @@ namespace connectivity
jobject callResultSetMethod( JNIEnv& _rEnv, const char* _pMethodName, jmethodID& _inout_MethodID ) const;
sal_Int32 callIntMethod_Throw(const char* _pMethodName, jmethodID& _inout_MethodID) const;
sal_Int32 callIntMethod_Nothrow(const char* _pMethodName, jmethodID& _inout_MethodID) const;
- sal_Int32 callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const;
+ sal_Int32 callIntMethodWithIntArg_Throw( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const;
+ sal_Int32 callIntMethodWithIntArg_Nothrow( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const;
sal_Int32 callIntMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const OUString& _nArgument ) const;
OUString callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const;
OUString callStringMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const;