Kaydet (Commit) e8ffa01c authored tarafından Ocke Janssen's avatar Ocke Janssen

#93784# fix some calls to jvm

üst e958e00d
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: DatabaseMetaData.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -301,6 +301,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( ...@@ -301,6 +301,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
char * cMethodName = "getTables"; char * cMethodName = "getTables";
// Java-Call absetzen // Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
t.pEnv->ExceptionClear();
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!"); OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
if( mID ) if( mID )
{ {
...@@ -310,6 +311,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( ...@@ -310,6 +311,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
{ {
jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0); jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0);
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!"); OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
t.pEnv->ExceptionClear();
const ::rtl::OUString* pBegin = types.getConstArray(); const ::rtl::OUString* pBegin = types.getConstArray();
for(sal_Int32 i=0;i<len;i++,++pBegin) for(sal_Int32 i=0;i<len;i++,++pBegin)
{ {
...@@ -317,6 +319,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( ...@@ -317,6 +319,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
//jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i)); //jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i));
t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT); t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT);
OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!"); OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
t.pEnv->ExceptionClear();
} }
args[3].l = pObjArray; args[3].l = pObjArray;
}else }else
...@@ -327,6 +330,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( ...@@ -327,6 +330,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); 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); 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!"); OSL_ENSURE(!t.pEnv->ExceptionOccurred(),"Exception occured!");
t.pEnv->ExceptionClear();
if(catalog.hasValue()) if(catalog.hasValue())
{ {
t.pEnv->DeleteLocalRef((jstring)args[0].l); t.pEnv->DeleteLocalRef((jstring)args[0].l);
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: JDriver.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -201,6 +201,13 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin ...@@ -201,6 +201,13 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
if(pDrvClass) if(pDrvClass)
{ {
saveRef(t.pEnv, pDrvClass->newInstanceObject()); 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; delete pDrvClass;
} }
break; break;
...@@ -246,6 +253,21 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin ...@@ -246,6 +253,21 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
args[1].l = pProps->getJavaObject(); args[1].l = pProps->getJavaObject();
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l ); 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 // und aufraeumen
t.pEnv->DeleteLocalRef((jstring)args[0].l); t.pEnv->DeleteLocalRef((jstring)args[0].l);
delete pProps; delete pProps;
...@@ -259,6 +281,8 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin ...@@ -259,6 +281,8 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
} //mID } //mID
if( object ) if( object )
{ {
t.pEnv->DeleteGlobalRef( theClass );
theClass = NULL;
t.pEnv->DeleteGlobalRef( object ); t.pEnv->DeleteGlobalRef( object );
object = NULL; object = NULL;
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: tools.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -165,6 +165,7 @@ jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUStr ...@@ -165,6 +165,7 @@ jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUStr
if (pEnv) if (pEnv)
{ {
pStr = pEnv->NewString(_rTemp.getStr(), _rTemp.getLength()); pStr = pEnv->NewString(_rTemp.getStr(), _rTemp.getLength());
pEnv->ExceptionClear();
OSL_ENSURE(pStr,"Could not create a jsstring object!"); OSL_ENSURE(pStr,"Could not create a jsstring object!");
} }
return pStr; return pStr;
...@@ -180,7 +181,8 @@ java_util_Properties* connectivity::createStringPropertyArray(JNIEnv *pEnv,const ...@@ -180,7 +181,8 @@ java_util_Properties* connectivity::createStringPropertyArray(JNIEnv *pEnv,const
for(;pBegin != pEnd;++pBegin) for(;pBegin != pEnd;++pBegin)
{ {
// this is a special property to find the jdbc driver // 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; ::rtl::OUString aStr;
pBegin->Value >>= aStr; pBegin->Value >>= aStr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment