HHH-10938 - Fix memory leak when bootstrapping EntityManagerFactory
This commit is contained in:
parent
66cf8cb632
commit
5553b9df27
|
@ -70,9 +70,7 @@ public class JarFileBasedArchiveDescriptor extends AbstractArchiveDescriptor {
|
|||
//
|
||||
// This algorithm assumes that the zipped file is only the URL root (including entry), not
|
||||
// just any random entry
|
||||
try {
|
||||
final InputStream is = new BufferedInputStream( jarFile.getInputStream( zipEntry ) );
|
||||
try {
|
||||
try (InputStream is = new BufferedInputStream( jarFile.getInputStream( zipEntry ) )) {
|
||||
final JarInputStream jarInputStream = new JarInputStream( is );
|
||||
ZipEntry subZipEntry = jarInputStream.getNextEntry();
|
||||
while ( subZipEntry != null ) {
|
||||
|
@ -106,10 +104,6 @@ public class JarFileBasedArchiveDescriptor extends AbstractArchiveDescriptor {
|
|||
subZipEntry = jarInputStream.getNextEntry();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new ArchiveException( "Error accessing JarFile entry [" + zipEntry.getName() + "]", e );
|
||||
}
|
||||
|
@ -118,8 +112,8 @@ public class JarFileBasedArchiveDescriptor extends AbstractArchiveDescriptor {
|
|||
final String name = extractName( zipEntry );
|
||||
final String relativeName = extractRelativeName( zipEntry );
|
||||
final InputStreamAccess inputStreamAccess;
|
||||
try {
|
||||
inputStreamAccess = buildByteBasedInputStreamAccess( name, jarFile.getInputStream( zipEntry ) );
|
||||
try (InputStream is = jarFile.getInputStream( zipEntry )) {
|
||||
inputStreamAccess = buildByteBasedInputStreamAccess( name, is );
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ArchiveException(
|
||||
|
|
Loading…
Reference in New Issue