summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/jdbc/Object.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/jdbc/Object.cxx')
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 6f4e78550dc0..73829b46ec64 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -43,7 +43,7 @@
#include <vos/mutex.hxx>
#include <osl/thread.h>
#include <com/sun/star/uno/Sequence.hxx>
-
+#include "java/LocalRef.hxx"
#include "resource/jdbc_log.hrc"
#include <rtl/logfile.hxx>
#include <comphelper/logging.hxx>
@@ -395,10 +395,9 @@ void java_lang_Object::callVoidMethodWithStringArg( const char* _pMethodName, jm
OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)V", _inout_MethodID);
- jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
// call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID , str);
- t.pEnv->DeleteLocalRef(str);
+ t.pEnv->CallVoidMethod( object, _inout_MethodID , str.get());
ThrowSQLException( t.pEnv, NULL );
}
// -------------------------------------------------------------------------
@@ -417,10 +416,9 @@ sal_Int32 java_lang_Object::callIntMethodWithStringArg( const char* _pMethodName
// *this
// );
- jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
// call method
- jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str);
- t.pEnv->DeleteLocalRef(str);
+ jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str.get());
ThrowSQLException( t.pEnv, NULL );
return (sal_Int32)out;
}