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 @@ -422,7 +422,8 @@ private Manifest getManifestFromReference() throws IOException {
422
422
jv = new JarVerifier (manEntry .getName (), b );
423
423
} else {
424
424
if (JarVerifier .debug != null ) {
425
- JarVerifier .debug .println ("Multiple MANIFEST.MF found. Treat JAR file as unsigned" );
425
+ JarVerifier .debug .println (
426
+ JarVerifier .MULTIPLE_MANIFEST_WARNING );
426
427
}
427
428
}
428
429
}
Original file line number Diff line number Diff line change @@ -97,7 +97,17 @@ private JarEntry checkManifest(JarEntry e)
97
97
jv = new JarVerifier (e .getName (), bytes );
98
98
mev = new ManifestEntryVerifier (man , jv .manifestName );
99
99
}
100
- return (JarEntry )super .getNextEntry ();
100
+ JarEntry nextEntry = (JarEntry )super .getNextEntry ();
101
+ if (nextEntry != null &&
102
+ JarFile .MANIFEST_NAME .equalsIgnoreCase (nextEntry .getName ())) {
103
+ if (JarVerifier .debug != null ) {
104
+ JarVerifier .debug .println (JarVerifier .MULTIPLE_MANIFEST_WARNING );
105
+ }
106
+
107
+ jv = null ;
108
+ mev = null ;
109
+ }
110
+ return nextEntry ;
101
111
}
102
112
return e ;
103
113
}
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