Merge branch '1.5.x'
This commit is contained in:
commit
85c7ed2746
|
@ -289,7 +289,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return (int) this.data.getSize();
|
return this.entries.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -120,6 +120,10 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable<JarEntry> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
private void sort(int left, int right) {
|
private void sort(int left, int right) {
|
||||||
// Quick sort algorithm, uses hashCodes as the source but sorts all arrays
|
// Quick sort algorithm, uses hashCodes as the source but sorts all arrays
|
||||||
if (left < right) {
|
if (left < right) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -31,6 +31,7 @@ import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarInputStream;
|
import java.util.jar.JarInputStream;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
@ -168,8 +169,10 @@ public class JarFileTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSize() {
|
public void getSize() throws Exception {
|
||||||
assertThat(this.jarFile.size()).isEqualTo((int) this.rootJarFile.length());
|
try (ZipFile zip = new ZipFile(this.rootJarFile)) {
|
||||||
|
assertThat(this.jarFile.size()).isEqualTo(zip.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue