On Mon, 24 Jul 2017, William Schilp wrote:

i'm using JCC to interface a C++ application to a java application. in the
java application a method can return a "null" java object. i need to
determine if the returned object is a null object. i do not see a way to do
this via the JCC interface. the object i get on the C++ side is an object
residing in memory space. so as far as C++ is concerned, the object is not
NULL as it points to a valid memory address, ie not 0.
so, how do i determine if the returned object is a null java object?

The java object is held by the 'jobject this$' member variable in the C++ wrapper. I think that if Java returned a null object, this$ is set to 0;

You might also be able to use the '!' operator declared on JObject:

    inline int operator!() const
    {
        return env->isSame(this$, NULL);
    }

if (!wrapper)  // java returned null
  ...

Andi..


bill

Reply via email to