summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-10-26 13:01:12 +0000
committerOcke Janssen <oj@openoffice.org>2001-10-26 13:01:12 +0000
commite8ffa01cda7c46398e4d85d51c90b5d1092595b5 (patch)
tree7d44d99ae3fb158d8ddeea9aaf3c74210016fd27 /connectivity/source
parente958e00d7998b739b6b5de75ad6edeaecbe11a0c (diff)
#93784# fix some calls to jvm
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx8
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx28
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx8
3 files changed, 37 insertions, 7 deletions
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index 7c07ab1e8871..fbfe21c36133 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DatabaseMetaData.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-08-14 07:21:03 $
+ * last change: $Author: oj $ $Date: 2001-10-26 14:01:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -301,6 +301,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
char * cMethodName = "getTables";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
+ t.pEnv->ExceptionClear();
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
if( mID )
{
@@ -310,6 +311,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
{
jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0);
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
+ t.pEnv->ExceptionClear();
const ::rtl::OUString* pBegin = types.getConstArray();
for(sal_Int32 i=0;i<len;i++,++pBegin)
{
@@ -317,6 +319,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
//jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i));
t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT);
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
+ t.pEnv->ExceptionClear();
}
args[3].l = pObjArray;
}else
@@ -327,6 +330,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
+ t.pEnv->ExceptionClear();
if(catalog.hasValue())
{
t.pEnv->DeleteLocalRef((jstring)args[0].l);
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
index 2d0b1512888d..8e0f7b9ff537 100644
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ b/connectivity/source/drivers/jdbc/JDriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JDriver.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: oj $ $Date: 2001-08-29 12:21:08 $
+ * last change: $Author: oj $ $Date: 2001-10-26 14:01:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -201,6 +201,13 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
if(pDrvClass)
{
saveRef(t.pEnv, pDrvClass->newInstanceObject());
+ jclass tempClass = t.pEnv->GetObjectClass(object);
+ if(object)
+ {
+ jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass );
+ t.pEnv->DeleteLocalRef( tempClass );
+ saveClassRef( globClass );
+ }
delete pDrvClass;
}
break;
@@ -246,6 +253,21 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
args[1].l = pProps->getJavaObject();
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l );
+ try
+ {
+ ThrowSQLException(t.pEnv,*this);
+ }
+ catch(const SQLException& )
+ {
+ t.pEnv->DeleteLocalRef((jstring)args[0].l);
+ delete pProps;
+ if( object )
+ {
+ t.pEnv->DeleteGlobalRef( object );
+ object = NULL;
+ }
+ throw;
+ }
// und aufraeumen
t.pEnv->DeleteLocalRef((jstring)args[0].l);
delete pProps;
@@ -259,6 +281,8 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
} //mID
if( object )
{
+ t.pEnv->DeleteGlobalRef( theClass );
+ theClass = NULL;
t.pEnv->DeleteGlobalRef( object );
object = NULL;
}
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 22b6963e3141..0721aa902135 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tools.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-08-14 07:21:03 $
+ * last change: $Author: oj $ $Date: 2001-10-26 14:01:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -165,6 +165,7 @@ jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUStr
if (pEnv)
{
pStr = pEnv->NewString(_rTemp.getStr(), _rTemp.getLength());
+ pEnv->ExceptionClear();
OSL_ENSURE(pStr,"Could not create a jsstring object!");
}
return pStr;
@@ -180,7 +181,8 @@ java_util_Properties* connectivity::createStringPropertyArray(JNIEnv *pEnv,const
for(;pBegin != pEnd;++pBegin)
{
// this is a special property to find the jdbc driver
- if(pBegin->Name.compareToAscii("JavaDriverClass"))
+ if( pBegin->Name.compareToAscii("JavaDriverClass") &&
+ pBegin->Name.compareToAscii("CharSet"))
{
::rtl::OUString aStr;
pBegin->Value >>= aStr;