I found a bug in VariantTransform::setReturnValue(jboolean in, VARIANT& returnValue).
I used comJava in a VB app and was accessing an java.util.Iterator object. The value returned by Iterator.next() when there is no more eleements is NULL causing the Variant value not to be set. I some environment (VB IDE, WSH/VBScriptthis) it means VARIANT_FALSE. However, in others (VB app out of IDE) it means VARIANT_TRUE. Though, the following fix:
void VariantTransform::setReturnValue(jboolean in, VARIANT& returnValue)
{
checkForException();
returnValue.vt = VT_BOOL;
if (in != NULL) {
if (in == JNI_TRUE)
returnValue.boolVal = VARIANT_TRUE;
else
returnValue.boolVal = VARIANT_FALSE;
}
else {
returnValue.boolVal = VARIANT_FALSE;
}
}
Bao-Long
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I found a bug in VariantTransform::setReturnValue(jboolean in, VARIANT& returnValue).
I used comJava in a VB app and was accessing an java.util.Iterator object. The value returned by Iterator.next() when there is no more eleements is NULL causing the Variant value not to be set. I some environment (VB IDE, WSH/VBScriptthis) it means VARIANT_FALSE. However, in others (VB app out of IDE) it means VARIANT_TRUE. Though, the following fix:
void VariantTransform::setReturnValue(jboolean in, VARIANT& returnValue)
{
checkForException();
returnValue.vt = VT_BOOL;
if (in != NULL) {
if (in == JNI_TRUE)
returnValue.boolVal = VARIANT_TRUE;
else
returnValue.boolVal = VARIANT_FALSE;
}
else {
returnValue.boolVal = VARIANT_FALSE;
}
}
Bao-Long