8034041: [parfait] JNI exception pending in jdk/src/macosx/native/com/apple/laf/AquaFileView.m
authorserb
Fri, 14 Feb 2014 02:19:19 +0400
changeset 23294 f53c3359f3bb
parent 23293 94f894482549
child 23295 6c61adf6111e
8034041: [parfait] JNI exception pending in jdk/src/macosx/native/com/apple/laf/AquaFileView.m Reviewed-by: anthony, bagiras
jdk/src/macosx/native/com/apple/laf/AquaFileView.m
--- a/jdk/src/macosx/native/com/apple/laf/AquaFileView.m	Thu Feb 13 14:45:58 2014 +0400
+++ b/jdk/src/macosx/native/com/apple/laf/AquaFileView.m	Fri Feb 14 02:19:19 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
@@ -23,6 +23,9 @@
  * questions.
  */
 
+
+#include <jni_util.h>
+
 #import "com_apple_laf_AquaFileView.h"
 
 #import <sys/param.h> // for MAXPATHLEN
@@ -98,6 +101,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -138,6 +142,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -153,7 +158,9 @@
     Boolean isDirectory = (isDir == JNI_TRUE ? true : false);
     FSRef ref;
 
-    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy, kFSPathMakeRefDoNotFollowLeafSymlink, &ref, &isDirectory);
+    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy,
+                                            kFSPathMakeRefDoNotFollowLeafSymlink,
+                                            &ref, &isDirectory);
     if (theErr == noErr) {
         CFStringRef displayName = NULL;
 
@@ -190,6 +197,7 @@
     size_t maxPathLen = sizeof(pathCString) - 1;
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, pathToAlias);
 
     if (length > maxPathLen) {
@@ -205,7 +213,8 @@
     OSErr theErr = FSPathMakeRef(pathCString, &fileRef, &isDirectory);
 
     Boolean ignored;
-    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored, &ignored, kResolveAliasFileNoUI);
+    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored,
+                                              &ignored, kResolveAliasFileNoUI);
     if (theErr == noErr) {
         UInt8 resolvedPath[MAXPATHLEN];
         theErr = FSRefMakePath(&fileRef, resolvedPath, MAXPATHLEN);