src/share/native/java/util/zip/ZipFile.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -69,16 +69,18 @@
     jobject x;
 
     if (msg != NULL) {
         s = JNU_NewStringPlatform(env, msg);
     }
+    if (s != NULL) {
     x = JNU_NewObjectByName(env,
                             "java/util/zip/ZipException",
                             "(Ljava/lang/String;)V", s);
     if (x != NULL) {
         (*env)->Throw(env, x);
     }
+    }
 }
 
 JNIEXPORT jlong JNICALL
 Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
                                         jint mode, jlong lastModified,

@@ -366,11 +368,13 @@
     }
 
     /* If some names were found then build array of java strings */
     if (count > 0) {
         jclass cls = (*env)->FindClass(env, "java/lang/String");
+        CHECK_NULL_RETURN(cls, NULL);
         result = (*env)->NewObjectArray(env, count, cls, 0);
+        CHECK_NULL_RETURN(result, NULL);
         if (result != 0) {
             for (i = 0; i < count; i++) {
                 jstring str = (*env)->NewStringUTF(env, zip->metanames[i]);
                 if (str == 0) {
                     break;