diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-08-14 06:21:03 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-08-14 06:21:03 +0000 |
commit | f9f3513d1476fbe3433fc1a8c093b0a53dc4c36c (patch) | |
tree | b5786c55dd150ec18ead4a87b0f5af6e8a65c5f8 /connectivity/source/drivers/jdbc/Class.cxx | |
parent | ef5ff4dda65354b289e052428e41b3bcfdf9535f (diff) |
#90553# convert classname in jni conform way
Diffstat (limited to 'connectivity/source/drivers/jdbc/Class.cxx')
-rw-r--r-- | connectivity/source/drivers/jdbc/Class.cxx | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index c01824d64c9b..c75777e8538c 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Class.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-08-06 13:28:47 $ + * last change: $Author: oj $ $Date: 2001-08-14 07:21:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,28 +104,12 @@ java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) { jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ){ - jvalue args[1]; - // Parameter konvertieren - args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); - // temporaere Variable initialisieren - char * cSignature = "(Ljava/lang/String;)Ljava/lang/Class;"; - char * cMethodName = "forName"; - // Java-Call absetzen - jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); - - if(!out) - { - t.pEnv->ExceptionClear(); - out = t.pEnv->FindClass(::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_ASCII_US)); - } - - ThrowSQLException(t.pEnv,0); - // und aufraeumen - } //mID - t.pEnv->DeleteLocalRef((jstring)args[0].l); + if( t.pEnv ) + { + ::rtl::OString sClassName = ::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_ASCII_US); + sClassName = sClassName.replace('.','/'); + out = t.pEnv->FindClass(sClassName); + ThrowSQLException(t.pEnv,0); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? NULL : new java_lang_Class( t.pEnv, out ); @@ -136,15 +120,16 @@ sal_Bool java_lang_Class::isAssignableFrom( java_lang_Class * _par0 ) jboolean out; SDBThreadAttach t; if( t.pEnv ){ - jvalue args[1]; - // Parameter konvertieren - args[0].l = _par0 != NULL ? ((java_lang_Object *)_par0)->getJavaObject() : NULL; + // temporaere Variable initialisieren char * cSignature = "(Ljava/lang/Class;)Z"; char * cMethodName = "isAssignableFrom"; // Java-Call absetzen jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); if( mID ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = _par0 != NULL ? ((java_lang_Object *)_par0)->getJavaObject() : NULL; out = t.pEnv->CallBooleanMethod( object, mID, args[0].l ); ThrowSQLException(t.pEnv,0); // und aufraeumen @@ -206,7 +191,8 @@ jobject java_lang_Class::newInstanceObject() if( mID ){ out = (jstring)t.pEnv->CallObjectMethod( object, mID); ThrowSQLException(t.pEnv,0); - aStr = JavaString2String(t.pEnv, (jstring)out ); + if(out) + aStr = JavaString2String(t.pEnv, (jstring)out ); } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! |