# HG changeset patch # User serb # Date 1392329959 -14400 # Node ID f53c3359f3bb3eb65a79e13f2a057b25af959bcb # Parent 94f8944825495507afcf8adc2e03723c2d2bdc7d 8034041: [parfait] JNI exception pending in jdk/src/macosx/native/com/apple/laf/AquaFileView.m Reviewed-by: anthony, bagiras diff -r 94f894482549 -r f53c3359f3bb 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 + #import "com_apple_laf_AquaFileView.h" #import // 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);