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 {
424
424
jv = new JarVerifier (manEntry .getName (), b );
425
425
} else {
426
426
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 );
428
429
}
429
430
}
430
431
}
Original file line number Diff line number Diff line change @@ -98,7 +98,17 @@ private JarEntry checkManifest(JarEntry e)
98
98
jv = new JarVerifier (e .getName (), bytes );
99
99
mev = new ManifestEntryVerifier (man , jv .manifestName );
100
100
}
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 ;
102
112
}
103
113
return e ;
104
114
}
Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
44
44
*/
45
45
class JarVerifier {
46
46
47
+ public static final String MULTIPLE_MANIFEST_WARNING =
48
+ "WARNING: Multiple MANIFEST.MF found. Treat JAR file as unsigned." ;
49
+
47
50
/* Are we debugging ? */
48
51
static final Debug debug = Debug .getInstance ("jar" );
49
52
You can’t perform that action at this time.
0 commit comments