U
Uli Kunkel
I call c++ dll and somethimes I get ArrayIndexOutOfBounds Exception.
The error is in the c++ function, but I don't know where.
Here is the relevant c++ function code:
--------------------------------
jbyteArray result = env->NewByteArray(DataSize);
size_t i;
for (i=0; i < DataSize; ++i)
{
jbyte n = (signed char)m_Data;
env->SetByteArrayRegion(result, i,1, &n );
}
return result;
-------------------------------------
m_Data is unsigned char* type
Maybe the NewByteArray couldn't allocate more space..
Do I have to delete the jbyteArray variable somehow?
How do I do it if I have to return it to the java?
Any suggestions would be appretiated.
The error is in the c++ function, but I don't know where.
Here is the relevant c++ function code:
--------------------------------
jbyteArray result = env->NewByteArray(DataSize);
size_t i;
for (i=0; i < DataSize; ++i)
{
jbyte n = (signed char)m_Data;
env->SetByteArrayRegion(result, i,1, &n );
}
return result;
-------------------------------------
m_Data is unsigned char* type
Maybe the NewByteArray couldn't allocate more space..
Do I have to delete the jbyteArray variable somehow?
How do I do it if I have to return it to the java?
Any suggestions would be appretiated.