src/java.base/share/native/libzip/Deflater.c

Print this page

        

*** 74,84 **** if (strm == 0) { JNU_ThrowOutOfMemoryError(env, 0); return jlong_zero; } else { ! char *msg; switch (deflateInit2(strm, level, Z_DEFLATED, nowrap ? -MAX_WBITS : MAX_WBITS, DEF_MEM_LEVEL, strategy)) { case Z_OK: return ptr_to_jlong(strm); --- 74,84 ---- if (strm == 0) { JNU_ThrowOutOfMemoryError(env, 0); return jlong_zero; } else { ! char *msg = 0; switch (deflateInit2(strm, level, Z_DEFLATED, nowrap ? -MAX_WBITS : MAX_WBITS, DEF_MEM_LEVEL, strategy)) { case Z_OK: return ptr_to_jlong(strm);
*** 88,99 **** --- 88,104 ---- return jlong_zero; case Z_STREAM_ERROR: free(strm); JNU_ThrowIllegalArgumentException(env, 0); return jlong_zero; + case Z_VERSION_ERROR: + msg = "Incompatible zlib version"; + /* intentionally no break */ default: + if (msg == 0) { msg = strm->msg; + } free(strm); JNU_ThrowInternalError(env, msg); return jlong_zero; } }