SF1570270 Proxy unhook detatched threads.

SF1538011 toString() not compliant, large ripple into toXXX() methods
SF1478172 Variant jni methods public without protection.  Now JNI methods behind java methods
This commit is contained in:
clay_shooter
2006-10-04 03:18:59 +00:00
parent a50685d412
commit 0b16b2eeae
14 changed files with 1306 additions and 738 deletions

View File

@@ -9,6 +9,18 @@
<li>Build process now notifies developer if version property missing
</ul>
</li>
<li>
<b>API Changes</b>
<ul>
<li>Variant.noParam() changed to Variant.putNoParam()
<li>Variant.toString() now follows normal java semantics.
This conflicted with the jacob toXXX() standard.
<li>Many Variant.toXXX() methods deprecated because folks didn't realize they were doing type conversion
Most calls to toXXX() methods should actually be getXXX() calls.
This also allowed toString() to follow Java conventions
<li>Variant native methods wrapped with java methods to better armor the Variant
</ul>
</li>
</ul>
<h3>Tracked Changes</h3>
@@ -18,11 +30,31 @@
</tr>
<tr>
<td width="13%">1550604</td>
<td width="87%">Build process died with confusing error if version not set in properties file</td>
<td width="87%">Build process died with confusing error if version not set in properties file(pre1)</td>
</tr>
<tr>
<td width="13%">SF1511033</td>
<td width="87%">Fix array index out of bounds problem due to coding error</td>
<td width="87%">Fix array index out of bounds problem due to coding error (pre1)</td>
</tr>
<tr>
<td width="13%">1570270 </td>
<td width="87%">~Event method in EventProxy may unhook java thread from VM.
Can get JNI error because unhooking listner detatched Java VM thread (pre1)</td>
</tr>
<tr>
<td width="13%">1538011 </td>
<td width="87%">toString() non compliant with java standards. The toString() method
converted the underlying data to a string and it shouldn't. This caused
a rethinking of all toXXX() methods other than toDispatch(). Most of the
toXXX() methods have now been deprecated and should be replaced with getXXX() methods.
(pre1)</td>
</tr>
<tr>
<td width="13%">1478162</td>
<td width="87%">Variant does not warn user if methods called after released.
All putXXX() and getXXX() methods now check to see if they've been released
prior to calling the JNI code. toXXX() methods are deprecated but protected
in the same way.(pre1)</td>
</tr>
<tr>
<td width="13%">&nbsp;</td>
@@ -36,7 +68,7 @@
<td width="87%">Support command line parameter dll location specification.
Applets and other tools can now specificy the dll location that
is fed to a System.load() rather than System.loadLibrary for the
situation where the app can't write the dll to a library path directory.</td>
situation where the app can't write the dll to a library path directory.(pre1)</td>
</tr>
<tr>
<td width="13%">&nbsp;</td>
@@ -49,7 +81,7 @@
<td width="13%">1550628</td>
<td width="87%">Moved all LoadLibrary requests into JacobObject. Classes not subclassed
off of JacobObject make calls to a static method on JacobObject to make sure
DLL is loaded</td>
DLL is loaded(pre1)</td>
</tr>
</table>

View File

@@ -33,15 +33,14 @@ EventProxy::EventProxy(JNIEnv *env,
eventIID(eid), MethNum(mNum), MethName(mName),
MethID(mID)
{
// don't really need the variant object but we keep a reference
// anyway
javaSinkObj = env->NewGlobalRef(aSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// keep a pointer to the sink
javaSinkObj = env->NewGlobalRef(aSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// we need this to attach to the event invocation thread
env->GetJavaVM(&jvm);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
AddRef();
env->GetJavaVM(&jvm);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
AddRef();
Connect(env);
}
@@ -60,24 +59,36 @@ EventProxy::~EventProxy()
{
JNIEnv *env;
Disconnect();
// attach to the current running thread
#ifdef JNI_VERSION_1_2
printf("using version 1.2 API\n");
jvm->AttachCurrentThread((void **)&env, jvm);
#else
printf("not using version 1.2 API\n");
jvm->AttachCurrentThread((void**)&env, NULL);
#endif
jint vmConnectionStatus = JNI_EVERSION ;
// attach to the current running thread -- JDK 1.4 jni.h has two param cover for 3 param call
vmConnectionStatus = jvm->GetEnv((void **)&env, JNI_VERSION_1_2);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
if (vmConnectionStatus == JNI_EDETACHED){
//printf("Unhook: Attaching to current thread using JNI Version 1.2 (%d)\n",vmConnectionStatus);
jvm->AttachCurrentThread((void **)&env, jvm);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
} else {
// should really look for JNI_OK versus an error
// started method hooked so no need to attach again
//printf("Unhook: No need to attach because already attached %d\n",vmConnectionStatus);
}
env->DeleteGlobalRef(javaSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
if (MethNum) {
delete [] MethName;
delete [] MethID;
}
env->DeleteGlobalRef(javaSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
if (MethNum) {
delete [] MethName;
delete [] MethID;
}
// detach from thread
jvm->DetachCurrentThread();
if (vmConnectionStatus == JNI_EDETACHED){
jvm->DetachCurrentThread();
//printf("Unhook: Detached\n");
} else {
//printf("Unhook: No need to detatch because attached prior to method\n");
}
//fflush(stdout);
}
void EventProxy::Disconnect() {
@@ -113,12 +124,9 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
LCID lcid, unsigned short wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
//Visual C++ 6.0 recognized this as an unused variable
//HRESULT hr;
const char *eventMethodName = NULL; //Sourceforge report 1394001
JNIEnv *env = NULL;
jobject retObj;
const char *eventMethodName = NULL; //Sourceforge report 1394001
JNIEnv *env = NULL;
jobject retObj;
// map dispID to jmethodID
for(int i=0;i<MethNum;i++)
@@ -130,33 +138,39 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
}
if (DISPATCH_METHOD & wFlags)
{
// attach to the current running thread
#ifdef JNI_VERSION_1_2
jvm->AttachCurrentThread((void **)&env, jvm);
#else
jvm->AttachCurrentThread((void**)&env, NULL);
#endif
//printf("Invoke: Attaching to current thread using JNI Version 1.2\n");
jvm->AttachCurrentThread((void **)&env, jvm);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
if (!eventMethodName)
{
ThrowComFail(env, "Event method received was not defined as part of callback interface", -1);
// user did not implement this method
printf("Invoke: didn't find method name\n");
ThrowComFail(env, "Event method received was not defined as part of callback interface", -1);
// should we detatch before returning?? The old code didn't but I don't see why not.
// jvm->DetachCurrentThread();
return S_OK;
}
// find the class of the InvocationHandler
jclass javaSinkClass = env->GetObjectClass(javaSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
jmethodID invokeMethod;
invokeMethod = env->GetMethodID(javaSinkClass, "invoke", "(Ljava/lang/String;[Lcom/jacob/com/Variant;)Lcom/jacob/com/Variant;");
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
//printf("Invoke: Got sink class\n");
jmethodID invokeMethod;
invokeMethod = env->GetMethodID(javaSinkClass, "invoke", "(Ljava/lang/String;[Lcom/jacob/com/Variant;)Lcom/jacob/com/Variant;");
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
jstring eventMethodNameAsString = env->NewStringUTF(eventMethodName);
//printf("Invoke: Got method name\n");
// now do what we need for the variant
jmethodID getVariantMethod = env->GetMethodID(javaSinkClass, "getVariant", "()Lcom/jacob/com/Variant;");
jmethodID getVariantMethod = env->GetMethodID(javaSinkClass, "getVariant", "()Lcom/jacob/com/Variant;");
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
//printf("Invoke: Found way too getVariant\n");
jobject aVariantObj = env->CallObjectMethod(javaSinkObj, getVariantMethod);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
//printf("Invoke: Made Variant\n");
jclass variantClass = env->GetObjectClass(aVariantObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
@@ -166,6 +180,7 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
// make an array of them
jobjectArray varr = env->NewObjectArray(numVariantParams, variantClass, 0);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
//printf("Invoke: Created Array\n");
int i,j;
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
{
@@ -181,14 +196,16 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
env->DeleteLocalRef(arg);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
}
// Set up the return value
jobject ret;
//printf("Invoke: Filled Array\n");
// Set up the return value
jobject ret;
ret = env->CallObjectMethod(javaSinkObj, invokeMethod,
eventMethodNameAsString, varr);
if (!env->ExceptionOccurred() && ret != NULL) {
VariantCopy(pVarResult, extractVariant(env,ret));
}
ret = env->CallObjectMethod(javaSinkObj, invokeMethod,
eventMethodNameAsString, varr);
//printf("Invoke: Invoked callback\n");
if (!env->ExceptionOccurred() && ret != NULL) {
VariantCopy(pVarResult, extractVariant(env,ret));
}
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// don't need the first variant we created to get the class
env->DeleteLocalRef(aVariantObj);
@@ -197,17 +214,19 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
// Begin code from Jiffie team that copies parameters back from java to COM
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
{
jobject arg = env->GetObjectArrayElement(varr, j);
VARIANT *java = extractVariant(env, arg);
VARIANT *com = &pDispParams->rgvarg[i];
convertJavaVariant(java, com);
zeroVariant(env, arg);
env->DeleteLocalRef(arg);
}
// End code from Jiffie team that copies parameters back from java to COM
// detach from thread
jvm->DetachCurrentThread();
return S_OK;
jobject arg = env->GetObjectArrayElement(varr, j);
VARIANT *java = extractVariant(env, arg);
VARIANT *com = &pDispParams->rgvarg[i];
convertJavaVariant(java, com);
zeroVariant(env, arg);
env->DeleteLocalRef(arg);
}
// End code from Jiffie team that copies parameters back from java to COM
// detach from thread
//printf("Invoke: Detatching\n");
jvm->DetachCurrentThread();
//fflush(stdout);
return S_OK;
}
return E_NOINTERFACE;
}

View File

@@ -155,61 +155,6 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_SerializationReadFromBytes
}
}
/**
* Converts the data to a Int object and then returns it as a Dispatch
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_toInt
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_I4))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jint)V_I4(v);
}
return NULL;
}
/**
* Converts the data to a Date object and then returns it as a Dispatch
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_toDate
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_DATE))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jdouble)V_DATE(v);
}
return NULL;
}
/**
* Converts the data to a Boolean object and then returns it as a Dispatch
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_toBoolean
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_BOOL))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jboolean)V_BOOL(v);
}
return NULL;
}
/**
* Converts the data to a Enum Variant object and then returns it as a Dispatch
*/
@@ -243,7 +188,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putNull
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNull
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -259,44 +204,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_cloneIndirect
return NULL;
}
/**
* Converts the data to a Double object and then returns it as a Dispatch
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_toDouble
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_R8))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jdouble)V_R8(v);
}
return NULL;
}
/**
* Converts the data to a Long object and then returns it as a Dispatch
*/
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_toCurrency
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_CY))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
CY cy = V_CY(v);
return (jlong)cy.int64;
}
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShortRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShortRef
(JNIEnv *env, jobject _this, jshort s)
{
VARIANT *v = extractVariant(env, _this);
@@ -309,7 +218,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShortRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putIntRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantIntRef
(JNIEnv *env, jobject _this, jint s)
{
VARIANT *v = extractVariant(env, _this);
@@ -322,7 +231,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putIntRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDoubleRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDoubleRef
(JNIEnv *env, jobject _this, jdouble s)
{
VARIANT *v = extractVariant(env, _this);
@@ -334,7 +243,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDoubleRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDateRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDateRef
(JNIEnv *env, jobject _this, jdouble s)
{
VARIANT *v = extractVariant(env, _this);
@@ -348,7 +257,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDateRef
}
// SF 1065533 added unicode support
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putStringRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantStringRef
(JNIEnv *env, jobject _this, jstring s)
{
VARIANT *v = extractVariant(env, _this);
@@ -371,7 +280,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putStringRef
env->ReleaseStringChars(s,cStr); }
}
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShortRef
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShortRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -384,7 +293,7 @@ JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShortRef
return NULL;
}
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getIntRef
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantIntRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -397,7 +306,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getIntRef
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShort
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShort
(JNIEnv *env, jobject _this, jshort s)
{
VARIANT *v = extractVariant(env, _this);
@@ -408,7 +317,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShort
}
}
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShort
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShort
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -421,7 +330,7 @@ JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShort
return NULL;
}
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDoubleRef
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDoubleRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -434,7 +343,7 @@ JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDoubleRef
return NULL;
}
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDateRef
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDateRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -447,7 +356,7 @@ JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDateRef
return NULL;
}
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getStringRef
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantStringRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -462,6 +371,9 @@ JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getStringRef
return NULL;
}
/**
* cover for underlying C VariantClear function
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_VariantClear
(JNIEnv *env, jobject _this)
{
@@ -474,7 +386,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_VariantClear
/**
* Converts the data to a Dispatch object and then returns it as a Dispatch
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toDispatchObject
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -503,42 +415,12 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_clone
return NULL;
}
/**
* Converts the data to a String object and then returns it as a Dispatch
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_toString
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
switch (V_VT(v))
{
case VT_EMPTY:
case VT_NULL:
case VT_ERROR:
// causes VariantChangeType to bomb
return env->NewStringUTF("null");
}
HRESULT hr;
// this actually changes the type of the variant to a String!
if (FAILED(hr = VariantChangeType(v, v, 0, VT_BSTR))) {
// cannot change type to a string
return env->NewStringUTF("???");
}
// create a returnable string from the converted variant
BSTR bs = V_BSTR(v);
jstring js = env->NewString(bs, SysStringLen(bs));
return js;
}
return NULL;
}
/**
* Returns the value of this int as a Boolea if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getInt
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantInt
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -556,7 +438,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getInt
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDate
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDate
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -569,7 +451,7 @@ JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDate
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putInt
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantInt
(JNIEnv *env, jobject _this, jint i)
{
VARIANT *v = extractVariant(env, _this);
@@ -580,7 +462,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putInt
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDate
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDate
(JNIEnv *env, jobject _this, jdouble date)
{
VARIANT *v = extractVariant(env, _this);
@@ -591,29 +473,11 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDate
}
}
/**
* Converts the data to a Byte object and then returns it as a Dispatch
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_toByte
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_UI1))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jbyte)V_UI1(v);
}
return NULL;
}
/**
* Returns the value of this Variant as a Boolea if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBoolean
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBoolean
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -630,7 +494,7 @@ JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBoolean
* Returns the value of this Variant as a Byte if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByte
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByte
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -643,7 +507,7 @@ JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByte
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBoolean
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBoolean
(JNIEnv *env, jobject _this, jboolean b)
{
VARIANT *v = extractVariant(env, _this);
@@ -652,10 +516,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBoolean
V_VT(v) = VT_BOOL;
V_BOOL(v) = b == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE;
}
else ThrowComFail(env, "putBoolean failed", -1);
else ThrowComFail(env, "putVariantBoolean failed", -1);
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByte
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByte
(JNIEnv *env, jobject _this, jbyte b)
{
VARIANT *v = extractVariant(env, _this);
@@ -664,25 +528,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByte
V_VT(v) = VT_UI1;
V_UI1(v) = b;
}
else ThrowComFail(env, "putByte failed", -1);
else ThrowComFail(env, "putVariantByte failed", -1);
}
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_toError
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_ERROR))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jint)V_ERROR(v);
}
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putEmpty
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantEmpty
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -695,7 +544,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putEmpty
/**
* Sets the variant type to dispatch with no value object
**/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putNothing
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNothing
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -705,7 +554,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putNothing
}
}
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getError
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantError
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -718,7 +567,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getError
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putError
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantError
(JNIEnv *env, jobject _this, jint i)
{
VARIANT *v = extractVariant(env, _this);
@@ -734,7 +583,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putError
* Returns the value of this Variant as a double if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDouble
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDouble
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -747,7 +596,7 @@ JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDouble
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrency
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrency
(JNIEnv *env, jobject _this, jlong cur)
{
VARIANT *v = extractVariant(env, _this);
@@ -757,7 +606,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrency
pf.int64 = (LONGLONG)cur;
V_VT(v) = VT_CY;
V_CY(v) = pf;
} else ThrowComFail(env, "putCurrency failed", -1);
} else ThrowComFail(env, "putVariantCurrency failed", -1);
}
/**
@@ -765,7 +614,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrency
* There is currently no way to pass NULL into this method
* to create something like "NOTHING" from VB
* */
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDispatchObject
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDispatch
(JNIEnv *env, jobject _this, jobject _that)
{
VARIANT *v = extractVariant(env, _this);
@@ -779,7 +628,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDispatchObject
} else ThrowComFail(env, "putObject failed", -1);
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDouble
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDouble
(JNIEnv *env, jobject _this, jdouble d)
{
VARIANT *v = extractVariant(env, _this);
@@ -794,7 +643,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDouble
* Returns the value of this Variant as a long if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrency
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrency
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -812,7 +661,7 @@ JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrency
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloatRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloatRef
(JNIEnv *env, jobject _this, jfloat val)
{
VARIANT *v = extractVariant(env, _this);
@@ -825,7 +674,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloatRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrencyRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrencyRef
(JNIEnv *env, jobject _this, jlong cur)
{
VARIANT *v = extractVariant(env, _this);
@@ -838,7 +687,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrencyRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putErrorRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantErrorRef
(JNIEnv *env, jobject _this, jint i)
{
VARIANT *v = extractVariant(env, _this);
@@ -849,7 +698,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putErrorRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBooleanRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBooleanRef
(JNIEnv *env, jobject _this, jboolean b)
{
VARIANT *v = extractVariant(env, _this);
@@ -862,7 +711,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBooleanRef
}
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByteRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByteRef
(JNIEnv *env, jobject _this, jbyte b)
{
VARIANT *v = extractVariant(env, _this);
@@ -879,7 +728,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByteRef
* Returns the value of this Variant as a String if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getString
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantString
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -894,8 +743,10 @@ JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getString
return NULL;
}
// SF 1065533 added unicode support
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putString
/**
* SF 1065533 added unicode support
* */
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantString
(JNIEnv *env, jobject _this, jstring s)
{
VARIANT *v = extractVariant(env, _this);
@@ -918,7 +769,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putString
}
}
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloatRef
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloatRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -931,7 +782,7 @@ JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloatRef
return NULL;
}
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrencyRef
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrencyRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -948,7 +799,7 @@ JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrencyRef
return NULL;
}
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getErrorRef
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantErrorRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -961,7 +812,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getErrorRef
return NULL;
}
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBooleanRef
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBooleanRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -975,7 +826,7 @@ JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBooleanRef
}
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByteRef
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByteRef
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -988,28 +839,10 @@ JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByteRef
return NULL;
}
/**
* Converts the data to a Float object and then returns it as a Dispatch
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_toFloat
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_R4))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jfloat)V_R4(v);
}
return NULL;
}
/**
* Converts the data to a Safe Array object and then returns it as a Dispatch
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toSafeArray
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantSafeArray
(JNIEnv *env, jobject _this, jboolean deepCopy)
{
VARIANT *v = extractVariant(env, _this);
@@ -1031,7 +864,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toSafeArray
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArrayRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArrayRef
(JNIEnv *env, jobject _this, jobject sa)
{
SAFEARRAY *psa = extractSA(env, sa);
@@ -1054,7 +887,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArrayRef
return;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArray
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArray
(JNIEnv *env, jobject _this, jobject sa)
{
SAFEARRAY *psa = extractSA(env, sa);
@@ -1078,7 +911,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArray
/**
* sets the type to VT_ERROR and the error message to DISP_E_PARAMNOTFOIUND
* */
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_noParam
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNoParam
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -1092,7 +925,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_noParam
* Returns the value of this Variant as a Float if it is of that type.
* Otherwise it will return null (no conversion done)
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloat
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloat
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -1105,7 +938,7 @@ JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloat
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloat
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloat
(JNIEnv *env, jobject _this, jfloat val)
{
VARIANT *v = extractVariant(env, _this);
@@ -1119,7 +952,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloat
/**
* changes the type of the underlying variant data
* */
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeType
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeVariantType
(JNIEnv *env, jobject _this, jshort t)
{
VARIANT *v = extractVariant(env, _this);
@@ -1132,7 +965,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeType
* returns the variant type if it is set, otherwise
* returns null
* */
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getvt
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantType
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
@@ -1142,39 +975,14 @@ JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getvt
return NULL;
}
/**
* Converts the data to a short object and then returns it as a Dispatch
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_toShort
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
HRESULT hr;
if (FAILED(hr = VariantChangeType(v, v, 0, VT_I2))) {
ThrowComFail(env, "VariantChangeType failed", hr);
return NULL;
}
return (jshort)V_I2(v);
}
return NULL;
}
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArrayRefHelper
(JNIEnv *env, jobject _this, jint pSA)
{
VARIANT *v = extractVariant(env, _this);
if (v) {
VariantClear(v); // whatever was there before
}
}
// removed Java_com_jacob_com_Variant_putSafeArrayRefHelper
/**
* this is a big cover method that returns TRUE if
* the variant type is
* VT_EMPTY, VT_NULL, VT_ERROR or VT_DISPATCH with no dispatch object
* */
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isNull
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isVariantConsideredNull
(JNIEnv *env, jobject _this)
{
VARIANT *v = extractVariant(env, _this);

View File

@@ -25,29 +25,6 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_jacob_com_Variant
* Method: toInt
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_toInt
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toDate
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_toDate
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toBoolean
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_toBoolean
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
@@ -59,10 +36,10 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant
/*
* Class: com_jacob_com_Variant
* Method: putNull
* Method: putVariantNull
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putNull
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNull
(JNIEnv *, jobject);
/*
@@ -75,106 +52,90 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_cloneIndirect
/*
* Class: com_jacob_com_Variant
* Method: toDouble
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_toDouble
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toCurrency
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_toCurrency
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putShortRef
* Method: putVariantShortRef
* Signature: (S)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShortRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShortRef
(JNIEnv *, jobject, jshort);
/*
* Class: com_jacob_com_Variant
* Method: putIntRef
* Method: putVariantIntRef
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putIntRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantIntRef
(JNIEnv *, jobject, jint);
/*
* Class: com_jacob_com_Variant
* Method: putDoubleRef
* Method: putVariantDoubleRef
* Signature: (D)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDoubleRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDoubleRef
(JNIEnv *, jobject, jdouble);
/*
* Class: com_jacob_com_Variant
* Method: putDateRef
* Method: putVariantDateRef
* Signature: (D)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDateRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDateRef
(JNIEnv *, jobject, jdouble);
/*
* Class: com_jacob_com_Variant
* Method: putStringRef
* Method: putVariantStringRef
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putStringRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantStringRef
(JNIEnv *, jobject, jstring);
/*
* Class: com_jacob_com_Variant
* Method: getShortRef
* Method: getVariantShortRef
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShortRef
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShortRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getIntRef
* Method: getVariantIntRef
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getIntRef
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantIntRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putShort
* Method: putVariantShort
* Signature: (S)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putShort
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShort
(JNIEnv *, jobject, jshort);
/*
* Class: com_jacob_com_Variant
* Method: getShort
* Method: getVariantShort
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getShort
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShort
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getDoubleRef
* Method: getVariantDoubleRef
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDoubleRef
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDoubleRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getDateRef
* Method: getVariantDateRef
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDateRef
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDateRef
(JNIEnv *, jobject);
/*
@@ -182,7 +143,7 @@ JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDateRef
* Method: getStringRef
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getStringRef
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantStringRef
(JNIEnv *, jobject);
/*
@@ -198,7 +159,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_com_jacob_com_VariantClear
* Method: toDispatch
* Signature: ()LDispatch;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toDispatchObject
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch
(JNIEnv *, jobject);
/*
@@ -211,194 +172,170 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_clone
/*
* Class: com_jacob_com_Variant
* Method: toString
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_toString
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getInt
* Method: getVariantInt
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getInt
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantInt
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getDate
* Method: getVariantDate
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDate
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDate
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putInt
* Method: putVariantInt
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putInt
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantInt
(JNIEnv *, jobject, jint);
/*
* Class: com_jacob_com_Variant
* Method: putDate
* Method: putVariantDate
* Signature: (D)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDate
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDate
(JNIEnv *, jobject, jdouble);
/*
* Class: com_jacob_com_Variant
* Method: toByte
* Signature: ()B
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_toByte
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getBoolean
* Method: getVariantBoolean
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBoolean
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBoolean
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getByte
* Method: getVariantByte
* Signature: ()B
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByte
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByte
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putBoolean
* Method: putVariantBoolean
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBoolean
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBoolean
(JNIEnv *, jobject, jboolean);
/*
* Class: com_jacob_com_Variant
* Method: putByte
* Method: putVariantByte
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByte
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByte
(JNIEnv *, jobject, jbyte);
/*
* Class: com_jacob_com_Variant
* Method: toError
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_toError
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putEmpty
* Method: putVariantEmpty
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putEmpty
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantEmpty
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putEmpty
* Method: putVariantNothing
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putNothing
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNothing
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getError
* Method: getVariantError
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getError
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantError
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putError
* Method: putVariantError
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putError
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantError
(JNIEnv *, jobject, jint);
/*
* Class: com_jacob_com_Variant
* Method: getDouble
* Method: getVariantDouble
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getDouble
JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDouble
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putCurrency
* Method: putVariantCurrency
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrency
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrency
(JNIEnv *, jobject, jlong);
/*
* Class: com_jacob_com_Variant
* Method: putObject
* Method: putVariantDispatch
* Signature: (Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDispatchObject
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDispatch
(JNIEnv *, jobject, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putDouble
* Method: putVariantDouble
* Signature: (D)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putDouble
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDouble
(JNIEnv *, jobject, jdouble);
/*
* Class: com_jacob_com_Variant
* Method: getCurrency
* Method: getVariantCurrency
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrency
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrency
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putFloatRef
* Method: putVariantFloatRef
* Signature: (F)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloatRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloatRef
(JNIEnv *, jobject, jfloat);
/*
* Class: com_jacob_com_Variant
* Method: putCurrencyRef
* Method: putVariantCurrencyRef
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putCurrencyRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrencyRef
(JNIEnv *, jobject, jlong);
/*
* Class: com_jacob_com_Variant
* Method: putErrorRef
* Method: putVariantErrorRef
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putErrorRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantErrorRef
(JNIEnv *, jobject, jint);
/*
* Class: com_jacob_com_Variant
* Method: putBooleanRef
* Method: putVariantBooleanRef
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putBooleanRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBooleanRef
(JNIEnv *, jobject, jboolean);
/*
@@ -411,10 +348,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putObjectRef
/*
* Class: com_jacob_com_Variant
* Method: putByteRef
* Method: putVariantByteRef
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByteRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByteRef
(JNIEnv *, jobject, jbyte);
/*
@@ -422,135 +359,119 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putByteRef
* Method: getString
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getString
JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantString
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putString
* Method: putVariantString
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putString
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantString
(JNIEnv *, jobject, jstring);
/*
* Class: com_jacob_com_Variant
* Method: getFloatRef
* Method: getVariantFloatRef
* Signature: ()F
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloatRef
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloatRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getCurrencyRef
* Method: getVariantCurrencyRef
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getCurrencyRef
JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrencyRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getErrorRef
* Method: getVariantErrorRef
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getErrorRef
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantErrorRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getBooleanRef
* Method: getVariantBooleanRef
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getBooleanRef
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBooleanRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getByteRef
* Method: getVariantByteRef
* Signature: ()B
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getByteRef
JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByteRef
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toFloat
* Signature: ()F
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_toFloat
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toSafeArray
* Method: toVariantSafeArray
* Signature: (Z)Lcom/jacob/com/SafeArray;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toSafeArray
JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantSafeArray
(JNIEnv *, jobject, jboolean);
/*
* Class: com_jacob_com_Variant
* Method: putSafeArrayRef
* Method: putVariantSafeArrayRef
* Signature: (LSafeArray;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArrayRef
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArrayRef
(JNIEnv *, jobject, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putSafeArray
* Method: putVariantSafeArray
* Signature: (LSafeArray;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putSafeArray
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArray
(JNIEnv *, jobject, jobject);
/*
* Class: com_jacob_com_Variant
* Method: noParam
* Method: putVariantNoParam
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_noParam
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNoParam
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: getFloat
* Method: getVariantFloat
* Signature: ()F
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getFloat
JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloat
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: putFloat
* Method: putVariantFloat
* Signature: (F)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloat
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloat
(JNIEnv *, jobject, jfloat);
/*
* Class: com_jacob_com_Variant
* Method: changeType
* Method: changeVariantType
* Signature: (S)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeType
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeVariantType
(JNIEnv *, jobject, jshort);
/*
* Class: com_jacob_com_Variant
* Method: getvt
* Method: getVariantType
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getvt
(JNIEnv *, jobject);
/*
* Class: com_jacob_com_Variant
* Method: toShort
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_toShort
JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantType
(JNIEnv *, jobject);
/*
@@ -577,10 +498,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_SerializationReadFromBytes
/*
* Class: com_jacob_com_Variant
* Method: isNull
* Method: isVariantConsideredNull
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isNull
JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isVariantConsideredNull
(JNIEnv *, jobject);
/*

View File

@@ -23,7 +23,8 @@ import com.jacob.com.*;
import com.jacob.activeX.*;
/**
* this
* May need to run with some command line options. If so, then try these
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true -Xcheck:jni
* @author joe
*
*/
@@ -124,7 +125,7 @@ class Access
public static String[] getColumns(Dispatch recset)
{
Dispatch flds = Dispatch.get(recset, "Fields").toDispatch();
int n_flds = Dispatch.get(flds, "Count").toInt();
int n_flds = Dispatch.get(flds, "Count").getInt();
String[] s = new String[n_flds];
Variant vi = new Variant();
for (int i=0;i<n_flds;i++) {

View File

@@ -48,7 +48,7 @@ public class Command extends Dispatch
public int getCommandTimeout()
{
return Dispatch.get(this, "CommandTimeout").toInt();
return Dispatch.get(this, "CommandTimeout").getInt();
}
public void setCommandTimeout(int plTimeout)
@@ -58,7 +58,7 @@ public class Command extends Dispatch
public boolean getPrepared()
{
return Dispatch.get(this, "Prepared").toBoolean();
return Dispatch.get(this, "Prepared").getBoolean();
}
public void setPrepared(boolean pfPrepared)
@@ -95,7 +95,7 @@ public class Command extends Dispatch
public int getCommandType()
{
return Dispatch.get(this, "CommandType").toInt();
return Dispatch.get(this, "CommandType").getInt();
}
public String getName()
@@ -110,7 +110,7 @@ public class Command extends Dispatch
public int getState()
{
return Dispatch.get(this, "State").toInt();
return Dispatch.get(this, "State").getInt();
}
public void Cancel()

View File

@@ -38,7 +38,7 @@ public class Connection extends Dispatch
public int getCommandTimeout()
{
return Dispatch.get(this, "CommandTimeout").toInt();
return Dispatch.get(this, "CommandTimeout").getInt();
}
public void setCommandTimeout(int plTimeout)
@@ -48,7 +48,7 @@ public class Connection extends Dispatch
public int getConnectionTimeout()
{
return Dispatch.get(this, "ConnectionTimeout").toInt();
return Dispatch.get(this, "ConnectionTimeout").getInt();
}
public void setConnectionTimeout(int plTimeout)
@@ -74,7 +74,7 @@ public class Connection extends Dispatch
public int BeginTrans()
{
return Dispatch.call(this, "BeginTrans").toInt();
return Dispatch.call(this, "BeginTrans").getInt();
}
public void CommitTrans()
@@ -114,7 +114,7 @@ public class Connection extends Dispatch
public int getIsolationLevel()
{
return Dispatch.get(this, "IsolationLevel").toInt();
return Dispatch.get(this, "IsolationLevel").getInt();
}
public void setIsolationLevel(int Level)
@@ -124,7 +124,7 @@ public class Connection extends Dispatch
public int getAttributes()
{
return Dispatch.get(this, "Attributes").toInt();
return Dispatch.get(this, "Attributes").getInt();
}
public void setAttributes(int plAttr)
@@ -134,7 +134,7 @@ public class Connection extends Dispatch
public int getCursorLocation()
{
return Dispatch.get(this, "CursorLocation").toInt();
return Dispatch.get(this, "CursorLocation").getInt();
}
public void setCursorLocation(int plCursorLoc)
@@ -144,7 +144,7 @@ public class Connection extends Dispatch
public int getMode()
{
return Dispatch.get(this, "Mode").toInt();
return Dispatch.get(this, "Mode").getInt();
}
public void setMode(int plMode)
@@ -164,7 +164,7 @@ public class Connection extends Dispatch
public int getState()
{
return Dispatch.get(this, "State").toInt();
return Dispatch.get(this, "State").getInt();
}
public Variant OpenSchema(int Schema, Variant Restrictions, Variant SchemaID)

View File

@@ -21,17 +21,17 @@ public class Field extends Dispatch
public int getActualSize()
{
return Dispatch.get(this, "ActualSize").toInt();
return Dispatch.get(this, "ActualSize").getInt();
}
public int getAttributes()
{
return Dispatch.get(this, "Attributes").toInt();
return Dispatch.get(this, "Attributes").getInt();
}
public int getDefinedSize()
{
return Dispatch.get(this, "DefinedSize").toInt();
return Dispatch.get(this, "DefinedSize").getInt();
}
public String getName()
@@ -41,7 +41,7 @@ public class Field extends Dispatch
public int getType()
{
return Dispatch.get(this, "Type").toInt();
return Dispatch.get(this, "Type").getInt();
}
public Variant getValue()
@@ -56,12 +56,12 @@ public class Field extends Dispatch
public byte getPrecision()
{
return Dispatch.get(this, "Precision").toByte();
return Dispatch.get(this, "Precision").getByte();
}
public byte getNumericScale()
{
return Dispatch.get(this, "NumericScale").toByte();
return Dispatch.get(this, "NumericScale").getByte();
}
public void AppendChunk(Variant Data)

View File

@@ -16,7 +16,7 @@ public class Fields extends Dispatch
public int getCount()
{
return Dispatch.get(this, "Count").toInt();
return Dispatch.get(this, "Count").getInt();
}
public Variant _NewEnum()

View File

@@ -26,7 +26,7 @@ public class Recordset extends Dispatch
public int getAbsolutePosition()
{
return Dispatch.get(this, "AbsolutePosition").toInt();
return Dispatch.get(this, "AbsolutePosition").getInt();
}
public void setAbsolutePosition(int pl)
@@ -51,7 +51,7 @@ public class Recordset extends Dispatch
public boolean getBOF()
{
return Dispatch.get(this, "BOF").toBoolean();
return Dispatch.get(this, "BOF").getBoolean();
}
public Variant getBookmark()
@@ -66,7 +66,7 @@ public class Recordset extends Dispatch
public int getCacheSize()
{
return Dispatch.get(this, "CacheSize").toInt();
return Dispatch.get(this, "CacheSize").getInt();
}
public void setCacheSize(int pl)
@@ -76,7 +76,7 @@ public class Recordset extends Dispatch
public int getCursorType()
{
return Dispatch.get(this, "CursorType").toInt();
return Dispatch.get(this, "CursorType").getInt();
}
public void setCursorType(int pl)
@@ -86,7 +86,7 @@ public class Recordset extends Dispatch
public boolean getEOF()
{
return Dispatch.get(this, "EOF").toBoolean();
return Dispatch.get(this, "EOF").getBoolean();
}
public Fields getFields()
@@ -96,7 +96,7 @@ public class Recordset extends Dispatch
public int getLockType()
{
return Dispatch.get(this, "LockType").toInt();
return Dispatch.get(this, "LockType").getInt();
}
public void setLockType(int plLockType)
@@ -106,7 +106,7 @@ public class Recordset extends Dispatch
public int getMaxRecords()
{
return Dispatch.get(this, "MaxRecords").toInt();
return Dispatch.get(this, "MaxRecords").getInt();
}
public void setMaxRecords(int pl)
@@ -116,7 +116,7 @@ public class Recordset extends Dispatch
public int getRecordCount()
{
return Dispatch.get(this, "RecordCount").toInt();
return Dispatch.get(this, "RecordCount").getInt();
}
public void setSource(Object pvSource)
@@ -212,7 +212,7 @@ public class Recordset extends Dispatch
public int getAbsolutePage()
{
return Dispatch.get(this, "AbsolutePage").toInt();
return Dispatch.get(this, "AbsolutePage").getInt();
}
public void setAbsolutePage(int pl)
@@ -222,7 +222,7 @@ public class Recordset extends Dispatch
public int getEditMode()
{
return Dispatch.get(this, "EditMode").toInt();
return Dispatch.get(this, "EditMode").getInt();
}
public Variant getFilter()
@@ -237,12 +237,12 @@ public class Recordset extends Dispatch
public int getPageCount()
{
return Dispatch.get(this, "PageCount").toInt();
return Dispatch.get(this, "PageCount").getInt();
}
public int getPageSize()
{
return Dispatch.get(this, "PageSize").toInt();
return Dispatch.get(this, "PageSize").getInt();
}
public void setPageSize(int pl)
@@ -262,12 +262,12 @@ public class Recordset extends Dispatch
public int getStatus()
{
return Dispatch.get(this, "Status").toInt();
return Dispatch.get(this, "Status").getInt();
}
public int getState()
{
return Dispatch.get(this, "State").toInt();
return Dispatch.get(this, "State").getInt();
}
public void UpdateBatch(int AffectRecords)
@@ -282,7 +282,7 @@ public class Recordset extends Dispatch
public int getCursorLocation()
{
return Dispatch.get(this, "CursorLocation").toInt();
return Dispatch.get(this, "CursorLocation").getInt();
}
public void setCursorLocation(int pl)
@@ -297,7 +297,7 @@ public class Recordset extends Dispatch
public boolean Supports(int CursorOptions)
{
return Dispatch.call(this, "Supports", new Variant(CursorOptions)).toBoolean();
return Dispatch.call(this, "Supports", new Variant(CursorOptions)).getBoolean();
}
public Variant getCollect(Variant Index)
@@ -312,7 +312,7 @@ public class Recordset extends Dispatch
public int getMarshalOptions()
{
return Dispatch.get(this, "MarshalOptions").toInt();
return Dispatch.get(this, "MarshalOptions").getInt();
}
public void setMarshalOptions(int pl)
@@ -357,7 +357,7 @@ public class Recordset extends Dispatch
public boolean getStayInSync()
{
return Dispatch.get(this, "StayInSync").toBoolean();
return Dispatch.get(this, "StayInSync").getBoolean();
}
public String GetString(int StringFormat, int NumRows, String ColumnDelimeter, String RowDelimeter, String NullExpr)
@@ -378,7 +378,7 @@ public class Recordset extends Dispatch
public int CompareBookmarks(Variant Bookmark1, Variant Bookmark2)
{
return Dispatch.call(this, "CompareBookmarks", Bookmark1, Bookmark2).toInt();
return Dispatch.call(this, "CompareBookmarks", Bookmark1, Bookmark2).getInt();
}
public Recordset Clone(int LockType)

View File

@@ -180,7 +180,7 @@ public class ActiveXComponent extends Dispatch {
* @return boolean value of property
*/
public boolean getPropertyAsBoolean(String propertyName){
return Dispatch.get(this, propertyName).toBoolean();
return Dispatch.get(this, propertyName).getBoolean();
}
/**
@@ -189,7 +189,7 @@ public class ActiveXComponent extends Dispatch {
* @return byte value of property
*/
public byte getPropertyAsByte(String propertyName){
return Dispatch.get(this, propertyName).toByte();
return Dispatch.get(this, propertyName).getByte();
}
/**
@@ -208,7 +208,7 @@ public class ActiveXComponent extends Dispatch {
* @return the property value as an int
*/
public int getPropertyAsInt(String propertyName){
return Dispatch.get(this,propertyName).toInt();
return Dispatch.get(this,propertyName).getInt();
}
/**

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
package com.jacob.com;
import java.util.Date;
/**
* runs through some of the get and set methods on Variant
*
@@ -9,6 +11,8 @@ class VariantTest {
public static void main(String[] args) {
System.out.println("Testing Started");
VariantTest testJig = new VariantTest();
testJig.testUninitializedVariant();
testJig.testToStringDoesNotConvert();
testJig.testPutsAndGets();
testJig.testSafeReleaseBoolean();
testJig.testSafeReleaseConstant();
@@ -26,40 +30,103 @@ class VariantTest {
}
private void testSafeReleaseBoolean(){
Variant v = new Variant(true);
System.out.println("Newly created Variant ("+ v.getBoolean()+") "+
"trying to create access violation but it doesn't seem to be easy");
v.safeRelease();
if (v.getBoolean() != true){
System.out.println("Variant value ("+v.getBoolean()+") "
+"has been broken by SafeRelease()");
} else {
System.out.println("Variant value ("+v.getBoolean()+") "
+"has survived SafeRelease()");
/**
* make sure variant with no backing store works.
*
*/
private void testUninitializedVariant(){
Variant v;
// Variants created without parameters are auto set to VariantEmpty
v = new Variant();
try {
if (v.getvt() == Variant.VariantEmpty){
// successful
// System.out.println("Variant initialized without parameters correctly set to empty");
} else {
throw new RuntimeException("getvt() on uninitialized variant shoud have returned VariantEmpty, instead returned "+v.getvt());
}
} catch (IllegalStateException ise){
throw new RuntimeException("getvt() on uninitialized variant shoud have succeeded, but instead threw exception");
}
try {
v.toString();
} catch (IllegalStateException ise){
System.out.println("toString() should never throw a runtime exception");
throw new RuntimeException("toString() should not blow up even with uninitialized Variant");
}
}
/**
*
* verify the toString() method does not do type conversion
*/
private void testToStringDoesNotConvert(){
Variant v;
v = new Variant(true);
v.toString();
if (v.getvt() != Variant.VariantBoolean){
throw new RuntimeException("toString() converted boolean to something else");
} else {
//System.out.println("toString() correctly does not convert type");
}
if (v.getBoolean() != true){
System.out.println("toString() converted boolean true to "+ v.getBoolean());
}
v = new Variant(false);
v.toString();
if (v.getvt() != Variant.VariantBoolean){
throw new RuntimeException("toString() converted boolean to something else");
} else {
//System.out.println("toString() correctly does not convert type");
}
if (v.getBoolean() != false){
System.out.println("toString() converted boolean false to "+ v.getBoolean());
}
}
private void testSafeReleaseBoolean(){
Variant v;
v = new Variant(true);
//System.out.println("Newly created Variant ("+ v.getBoolean()+") "+
// "trying to create access violation but it doesn't seem to be easy");
v.safeRelease();
try {
v.getBoolean();
System.out.println("IllegalStateException should have been thrown when querying safeReleased object");
throw new RuntimeException("test failed");
} catch (IllegalStateException ise){
//System.out.println("IllegalStateException correctly thrown after safeRelease");
}
v = new Variant(true);
for ( int i = 0 ; i < 10; i ++){
new Variant ("xxx"+i);
new Variant(i);
new Variant ("yyy"+i);
}
ComThread.Release();
if (v.getBoolean() != true){
System.out.println("Variant value ("+v.getBoolean()+") "
+"has been broken by ComThread.Release()");
} else {
System.out.println("Variant value ("+v.getBoolean()+") "
+"has been survived by ComThread.Release()");
try {
v.getBoolean();
System.out.println("IllegalStateException should have been thrown when querying ComThread.Release");
throw new RuntimeException("test failed");
} catch (IllegalStateException ise){
//System.out.println("IllegalStateException correctly thrown after ComThread.Release");
}
}
/**
* verify the constant values aren't released with safeRelease
*
*/
private void testSafeReleaseConstant(){
System.out.println("Using Static constant Variant - should never throw access violation");
Variant.VT_TRUE.safeRelease();
if (Variant.VT_TRUE.getBoolean() != true){
System.out.println("VT_TRUE has been broken by SafeRelease()");
throw new RuntimeException("test failed");
} else {
System.out.println("VT_TRUE survived SafeRelease()");
//System.out.println("VT_TRUE survived SafeRelease()");
}
for ( int i = 0 ; i < 10; i ++){
@@ -71,24 +138,31 @@ class VariantTest {
if (Variant.VT_TRUE.getBoolean() != true){
System.out.println("VT_TRUE has been broken by ComThread.Release()");
throw new RuntimeException("test failed");
} else {
System.out.println("VT_TRUE survived ComThread.Release()");
//System.out.println("VT_TRUE survived ComThread.Release()");
}
}
/**
* this used to try and and create an access violation but that
* didn't work and now the methods on the Variant are smarter about
* working after a release
*
*/
private void testSafeReleaseString(){
String mTestString = "Guitar Hero";
Variant v = new Variant(mTestString);
System.out.println("Newly created Variant ("+ v.getString()+") "+
"trying to create access violation but it doesn't seem to be easy");
//System.out.println("Newly created Variant ("+ v.getString()+") "+
// "about to safe release and then access");
v.safeRelease();
if (v.getString() == null || !v.getString().equals(mTestString)){
System.out.println("Variant value ("+v.getString()+") "
+"has been broken by SafeRelease()");
} else {
System.out.println("Variant value ("+v.getString()+") "
+"has survived SafeRelease()");
try {
v.getString();
System.out.println("IllegalStateException should have been thrown when querying safeReleased object");
throw new RuntimeException("test failed");
} catch (IllegalStateException ise){
//System.out.println("IllegalStateException correctly thrown after safeRelease");
}
}
@@ -127,28 +201,47 @@ class VariantTest {
private void testPutsAndGets(){
Variant v = new Variant();
v.putInt(10);
if (v.toInt() != 10){
if (v.getInt() != 10){
System.out.println("int test failed");
}
v.putInt(10);
if (v.toDouble() != 10.0){
v.putShort((short)10);
if (v.getShort() != 10){
System.out.println("short test failed");
}
v.putByte((byte)10);
if (v.getByte() != 10){
System.out.println("int test failed");
}
v.putFloat(10);
if (v.getFloat() != 10.0){
System.out.println("float test failed");
}
v.putDouble(10);
if (v.getDouble() != 10.0){
System.out.println("double test failed");
}
v.putString("1234.567");
if (!"1234.567".equals(v.toString())){
if (!"1234.567".equals(v.getString())){
System.out.println("string test failed");
}
v.putBoolean(true);
if (v.toBoolean() != true){
if (v.getBoolean() != true){
System.out.println("failed boolean test(true)");
}
v.putBoolean(false);
if (v.toBoolean() != false){
if (v.getBoolean() != false){
System.out.println("failed boolean test(false)");
}
v.putCurrency(123456789123456789L);
if (v.toCurrency()!=123456789123456789L){
System.out.println("failed long test");
if (v.getCurrency()!=123456789123456789L){
System.out.println("failed currency test");
}
Date ourDate = new Date();
v.putDate(ourDate);
Date retrievedDate = v.getJavaDate();
if (!retrievedDate.equals(ourDate)){
System.out.println("failed java date load and unload");
}
v.putNull();

View File

@@ -34,10 +34,12 @@ class IETest
//e.printStackTrace();
}
}
System.out.println("Thread quit, about to quit main sta");
System.out.println("Main: Thread quit, about to quit main sta in thread "
+Thread.currentThread().getName());
// this line only does someting if startMainSTA() was called
ComThread.quitMainSTA();
System.out.println("did quit main sta");
System.out.println("Main: did quit main sta in thread "
+Thread.currentThread().getName());
}
}
@@ -59,22 +61,33 @@ class IETestThread extends Thread
try {
Dispatch.put(ie, "Visible", new Variant(true));
Dispatch.put(ie, "AddressBar", new Variant(true));
System.out.println(Dispatch.get(ie, "Path"));
System.out.println("IETestThread: " + Dispatch.get(ie, "Path"));
Dispatch.put(ie, "StatusText", new Variant("My Status Text"));
System.out.println("IETestThread: About to hookup event listener");
IEEvents ieE = new IEEvents();
new DispatchEvents((Dispatch) ie, ieE,"InternetExplorer.Application.1");
System.out.println("IETestThread: Did hookup event listener");
/// why is this here? Was there some other code here in the past?
Variant optional = new Variant();
optional.noParam();
optional.putNoParam();
System.out.println("IETestThread: About to call navigate to sourceforge");
Dispatch.call(ie, "Navigate", new Variant("http://sourceforge.net/projects/jacob-project"));
System.out.println("IETestThread: Did call navigate to sourceforge");
try { Thread.sleep(delay); } catch (Exception e) {}
System.out.println("IETestThread: About to call navigate to yahoo");
Dispatch.call(ie, "Navigate", new Variant("http://groups.yahoo.com/group/jacob-project"));
System.out.println("IETestThread: Did call navigate to yahoo");
try { Thread.sleep(delay); } catch (Exception e) {}
} catch (Exception e) {
e.printStackTrace();
} catch (Throwable re){
re.printStackTrace();
} finally {
ie.invoke("Quit", new Variant[] {});
System.out.println("IETestThread: About to send Quit");
ie.invoke("Quit", new Variant[] {});
System.out.println("IETestThread: Did send Quit");
}
// this blows up when it tries to release a DispatchEvents object
// I think this is because there is still one event we should get back
@@ -83,13 +96,14 @@ class IETestThread extends Thread
// freed before the callback
// commenting out ie.invoke(quit...) causes this to work without error
// this code tries to wait until the quit has been handled but that doesn't work
System.out.println("IETest: Waiting until we've received the quit callback");
System.out.println("IETestThread: Waiting until we've received the quit callback");
while (!quitHandled){
try { Thread.sleep(delay/5);} catch (InterruptedException e) {}
}
System.out.println("IETestThread: Received the quit callback");
// wait a little while for it to end
try {Thread.sleep(delay); } catch (InterruptedException e) {}
System.out.println("IETest: about to call release in thread " +
//try {Thread.sleep(delay); } catch (InterruptedException e) {}
System.out.println("IETestThread: about to call ComThread.Release in thread " +
Thread.currentThread().getName());
ComThread.Release();
@@ -101,76 +115,76 @@ class IETestThread extends Thread
public class IEEvents
{
public void BeforeNavigate2(Variant[] args) {
System.out.println("IEEvents: BeforeNavigate2");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): BeforeNavigate2 "+args.length);
}
public void CommandStateChange(Variant[] args) {
System.out.println("IEEvents: CommandStateChange");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): CommandStateChange "+args.length);
}
public void DocumentComplete(Variant[] args) {
System.out.println("IEEvents: DocumentComplete");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): DocumentComplete "+args.length);
}
public void DownloadBegin(Variant[] args) {
System.out.println("IEEvents: DownloadBegin");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): DownloadBegin "+args.length);
}
public void DownloadComplete(Variant[] args) {
System.out.println("IEEvents: DownloadComplete");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): DownloadComplete "+args.length);
}
public void NavigateComplete2(Variant[] args) {
System.out.println("IEEvents: NavigateComplete2");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): NavigateComplete "+args.length);
}
public void NewWindow2(Variant[] args) {
System.out.println("IEEvents: NewWindow2");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): NewWindow2 "+args.length);
}
public void OnFullScreen(Variant[] args) {
System.out.println("IEEvents: OnFullScreen");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnFullScreen "+args.length);
}
public void OnMenuBar(Variant[] args) {
System.out.println("IEEvents: OnMenuBar");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnMenuBar "+args.length);
}
public void OnQuit(Variant[] args) {
System.out.println("IEEvents: OnQuit");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnQuit "+args.length);
IETestThread.quitHandled = true;
}
public void OnStatusBar(Variant[] args) {
System.out.println("IEEvents: OnStatusBar");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnStatusBar "+args.length);
}
public void OnTheaterMode(Variant[] args) {
System.out.println("IEEvents: OnTheaterMode");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnTheaterMode "+args.length);
}
public void OnToolBar(Variant[] args) {
System.out.println("IEEvents: OnToolBar");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnToolBar "+args.length);
}
public void OnVisible(Variant[] args) {
System.out.println("IEEvents: OnVisible");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): OnVisible "+args.length);
}
public void ProgressChange(Variant[] args) {
System.out.println("IEEvents: ProgressChange");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): ProgressChange "+args.length);
}
public void PropertyChange(Variant[] args) {
System.out.println("IEEvents: PropertyChange");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): PropertyChange "+args.length);
}
public void StatusTextChange(Variant[] args) {
System.out.println("IEEvents: StatusTextChange");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): StatusTextChange "+args.length);
}
public void TitleChange(Variant[] args) {
System.out.println("IEEvents: TitleChange");
System.out.println("IEEvents Received ("+Thread.currentThread().getName()+"): TitleChange "+args.length);
}
}