< prev index next >
src/java.base/share/classes/java/util/jar/JarFile.java
Print this page
rev 16859 : 8176709: JarFileSystem::isMultiReleaseJar is incorrect
Reviewed-by: alanb, sherman, psandoz, mchung
*** 923,933 ****
* Returns true if the pattern {@code src} is found in {@code b}.
* The {@code lastOcc} array is the precomputed bad character shifts.
* Since there are no repeated substring in our search strings,
* the good suffix shifts can be replaced with a comparison.
*/
! private int match(byte[] src, byte[] b, byte[] lastOcc, byte[] optoSft) {
int len = src.length;
int last = b.length - len;
int i = 0;
next:
while (i <= last) {
--- 923,933 ----
* Returns true if the pattern {@code src} is found in {@code b}.
* The {@code lastOcc} array is the precomputed bad character shifts.
* Since there are no repeated substring in our search strings,
* the good suffix shifts can be replaced with a comparison.
*/
! private static int match(byte[] src, byte[] b, byte[] lastOcc, byte[] optoSft) {
int len = src.length;
int last = b.length - len;
int i = 0;
next:
while (i <= last) {
*** 970,979 ****
--- 970,981 ----
byte[] b = getBytes(manEntry);
hasClassPathAttribute = match(CLASSPATH_CHARS, b,
CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT) != -1;
// is this a multi-release jar file
if (MULTI_RELEASE_ENABLED) {
+ // Keep this implementation up to date with
+ // JarFileSystem::isMultiReleaseJar
int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
MULTIRELEASE_OPTOSFT);
if (i != -1) {
i += MULTIRELEASE_CHARS.length;
if (i < b.length) {
< prev index next >