8024697: Fix for 8020983 causes Xcheck:jni warnings

Reviewed-by: prr, jchen
This commit is contained in:
Andrew Brygin 2013-09-13 20:28:17 +04:00
parent 47f48cad92
commit e3016af23b
2 changed files with 12 additions and 8 deletions

View File

@ -930,9 +930,10 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo)
* Now fill a complete buffer, or as much of one as the stream * Now fill a complete buffer, or as much of one as the stream
* will give us if we are near the end. * will give us if we are near the end.
*/ */
RELEASE_ARRAYS(env, data, src->next_input_byte);
GET_IO_REF(input); GET_IO_REF(input);
RELEASE_ARRAYS(env, data, src->next_input_byte);
ret = (*env)->CallIntMethod(env, ret = (*env)->CallIntMethod(env,
input, input,
JPEGImageReader_readInputDataID, JPEGImageReader_readInputDataID,
@ -1017,9 +1018,11 @@ imageio_fill_suspended_buffer(j_decompress_ptr cinfo)
memcpy(sb->buf, src->next_input_byte, offset); memcpy(sb->buf, src->next_input_byte, offset);
} }
GET_IO_REF(input);
RELEASE_ARRAYS(env, data, src->next_input_byte); RELEASE_ARRAYS(env, data, src->next_input_byte);
GET_IO_REF(input);
buflen = sb->bufferLength - offset; buflen = sb->bufferLength - offset;
if (buflen <= 0) { if (buflen <= 0) {
if (!GET_ARRAYS(env, data, &(src->next_input_byte))) { if (!GET_ARRAYS(env, data, &(src->next_input_byte))) {
@ -1121,9 +1124,10 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
return; return;
} }
RELEASE_ARRAYS(env, data, src->next_input_byte);
GET_IO_REF(input); GET_IO_REF(input);
RELEASE_ARRAYS(env, data, src->next_input_byte);
ret = (*env)->CallLongMethod(env, ret = (*env)->CallLongMethod(env,
input, input,
JPEGImageReader_skipInputBytesID, JPEGImageReader_skipInputBytesID,
@ -2306,10 +2310,10 @@ imageio_empty_output_buffer (j_compress_ptr cinfo)
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject output = NULL; jobject output = NULL;
GET_IO_REF(output);
RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
GET_IO_REF(output);
(*env)->CallVoidMethod(env, (*env)->CallVoidMethod(env,
output, output,
JPEGImageWriter_writeOutputDataID, JPEGImageWriter_writeOutputDataID,
@ -2348,10 +2352,10 @@ imageio_term_destination (j_compress_ptr cinfo)
if (datacount != 0) { if (datacount != 0) {
jobject output = NULL; jobject output = NULL;
GET_IO_REF(output);
RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
GET_IO_REF(output);
(*env)->CallVoidMethod(env, (*env)->CallVoidMethod(env,
output, output,
JPEGImageWriter_writeOutputDataID, JPEGImageWriter_writeOutputDataID,

View File

@ -23,7 +23,7 @@
/** /**
* @test * @test
* @bug 8020983 * @bug 8020983 8024697
* @summary Test verifies that jpeg writer instances are collected * @summary Test verifies that jpeg writer instances are collected
* even if destroy() or reset() methods is not invoked. * even if destroy() or reset() methods is not invoked.
* *