From 6adf75b9ebe2f74f0fabd76d7e3f1535374a93c8 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 24 Feb 2014 12:51:58 +0400 Subject: [PATCH] 8030788: [Parfait] warnings from b119 for jdk/src/share/native/sun/awt/medialib: JNI exception pending Reviewed-by: serb, prr --- .../native/sun/awt/medialib/awt_ImagingLib.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c index 887c7bd235d..db69fd78e4f 100644 --- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c +++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1106,6 +1106,7 @@ fprintf(stderr,"Flags : %d\n",dst->flags); if (ddata == NULL) { /* Need to store it back into the array */ if (storeRasterArray(env, srcRasterP, dstRasterP, dst) < 0) { + (*env)->ExceptionClear(env); // Could not store the array, try another way retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst)); } } @@ -2014,6 +2015,7 @@ cvtCustomToDefault(JNIEnv *env, BufImageS_t *imageP, int component, jpixels = (*env)->NewIntArray(env, nbytes); if (JNU_IsNull(env, jpixels)) { + (*env)->ExceptionClear(env); JNU_ThrowOutOfMemoryError(env, "Out of Memory"); return -1; } @@ -2079,6 +2081,7 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component, jpixels = (*env)->NewIntArray(env, nbytes); if (JNU_IsNull(env, jpixels)) { + (*env)->ExceptionClear(env); JNU_ThrowOutOfMemoryError(env, "Out of Memory"); return -1; } @@ -2775,21 +2778,14 @@ static int expandICM(JNIEnv *env, BufImageS_t *imageP, unsigned int *mDataP) /* Need to grab the lookup tables. Right now only bytes */ rgb = (int *) (*env)->GetPrimitiveArrayCritical(env, cmP->jrgb, NULL); + CHECK_NULL_RETURN(rgb, -1); /* Interleaved with shared data */ dataP = (void *) (*env)->GetPrimitiveArrayCritical(env, rasterP->jdata, NULL); - if (rgb == NULL || dataP == NULL) { + if (dataP == NULL) { /* Release the lookup tables */ - if (rgb) { - (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb, - JNI_ABORT); - } - if (dataP) { - (*env)->ReleasePrimitiveArrayCritical(env, - rasterP->jdata, dataP, - JNI_ABORT); - } + (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb, JNI_ABORT); return -1; }