8034105: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/CImage.m
Reviewed-by: anthony, bagiras
--- a/jdk/src/macosx/native/sun/awt/CImage.m Tue Feb 25 16:46:52 2014 +0400
+++ b/jdk/src/macosx/native/sun/awt/CImage.m Tue Feb 25 17:01:40 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -143,21 +143,23 @@
NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num];
jint * ws = (*env)->GetIntArrayElements(env, widths, NULL);
- jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
-
- jsize i;
- for (i = 0; i < num; i++) {
- jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
+ if (ws != NULL) {
+ jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
+ if (hs != NULL) {
+ jsize i;
+ for (i = 0; i < num; i++) {
+ jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
- NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
- if (imageRep) {
- [reps addObject: imageRep];
+ NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
+ if (imageRep) {
+ [reps addObject: imageRep];
+ }
+ }
+
+ (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
}
+ (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
}
-
- (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
- (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
-
if ([reps count]) {
NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
[nsImage addRepresentations: reps];