File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
src/java.base/share/classes/java/util/jar Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,8 @@ private Manifest getManifestFromReference() throws IOException {
424424 jv = new JarVerifier (manEntry .getName (), b );
425425 } else {
426426 if (JarVerifier .debug != null ) {
427- JarVerifier .debug .println ("Multiple MANIFEST.MF found. Treat JAR file as unsigned" );
427+ JarVerifier .debug .println (
428+ JarVerifier .MULTIPLE_MANIFEST_WARNING );
428429 }
429430 }
430431 }
Original file line number Diff line number Diff line change @@ -98,7 +98,17 @@ private JarEntry checkManifest(JarEntry e)
9898 jv = new JarVerifier (e .getName (), bytes );
9999 mev = new ManifestEntryVerifier (man , jv .manifestName );
100100 }
101- return (JarEntry )super .getNextEntry ();
101+ JarEntry nextEntry = (JarEntry )super .getNextEntry ();
102+ if (nextEntry != null &&
103+ JarFile .MANIFEST_NAME .equalsIgnoreCase (nextEntry .getName ())) {
104+ if (JarVerifier .debug != null ) {
105+ JarVerifier .debug .println (JarVerifier .MULTIPLE_MANIFEST_WARNING );
106+ }
107+
108+ jv = null ;
109+ mev = null ;
110+ }
111+ return nextEntry ;
102112 }
103113 return e ;
104114 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 1997, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1997, 2024 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
4444 */
4545class JarVerifier {
4646
47+ public static final String MULTIPLE_MANIFEST_WARNING =
48+ "WARNING: Multiple MANIFEST.MF found. Treat JAR file as unsigned." ;
49+
4750 /* Are we debugging ? */
4851 static final Debug debug = Debug .getInstance ("jar" );
4952
You can’t perform that action at this time.
0 commit comments