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 @@ -409,7 +409,8 @@ private Manifest getManifestFromReference() throws IOException {
409409 jv = new JarVerifier (manEntry .getName (), b );
410410 } else {
411411 if (JarVerifier .debug != null ) {
412- JarVerifier .debug .println ("Multiple MANIFEST.MF found. Treat JAR file as unsigned" );
412+ JarVerifier .debug .println (
413+ JarVerifier .MULTIPLE_MANIFEST_WARNING );
413414 }
414415 }
415416 }
Original file line number Diff line number Diff line change @@ -151,7 +151,17 @@ private JarEntry checkManifest(JarEntry e)
151151 jv = new JarVerifier (e .getName (), bytes );
152152 mev = new ManifestEntryVerifier (man , jv .manifestName );
153153 }
154- return (JarEntry )super .getNextEntry ();
154+ JarEntry nextEntry = (JarEntry )super .getNextEntry ();
155+ if (nextEntry != null &&
156+ JarFile .MANIFEST_NAME .equalsIgnoreCase (nextEntry .getName ())) {
157+ if (JarVerifier .debug != null ) {
158+ JarVerifier .debug .println (JarVerifier .MULTIPLE_MANIFEST_WARNING );
159+ }
160+
161+ jv = null ;
162+ mev = null ;
163+ }
164+ return nextEntry ;
155165 }
156166 return e ;
157167 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 1997, 2023 , 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
4646 */
4747class JarVerifier {
4848
49+ public static final String MULTIPLE_MANIFEST_WARNING =
50+ "WARNING: Multiple MANIFEST.MF found. Treat JAR file as unsigned." ;
51+
4952 /* Are we debugging ? */
5053 static final Debug debug = Debug .getInstance ("jar" );
5154
You can’t perform that action at this time.
0 commit comments