HHH-10938 - Fix memory leak when bootstrapping EntityManagerFactory
This commit is contained in:
parent
66cf8cb632
commit
5553b9df27
|
@ -70,44 +70,38 @@ 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 {
|
||||
final JarInputStream jarInputStream = new JarInputStream( is );
|
||||
ZipEntry subZipEntry = jarInputStream.getNextEntry();
|
||||
while ( subZipEntry != null ) {
|
||||
if ( ! subZipEntry.isDirectory() ) {
|
||||
try (InputStream is = new BufferedInputStream( jarFile.getInputStream( zipEntry ) )) {
|
||||
final JarInputStream jarInputStream = new JarInputStream( is );
|
||||
ZipEntry subZipEntry = jarInputStream.getNextEntry();
|
||||
while ( subZipEntry != null ) {
|
||||
if ( ! subZipEntry.isDirectory() ) {
|
||||
|
||||
final String name = extractName( subZipEntry );
|
||||
final String relativeName = extractRelativeName( subZipEntry );
|
||||
final InputStreamAccess inputStreamAccess = buildByteBasedInputStreamAccess( name, jarInputStream );
|
||||
final String name = extractName( subZipEntry );
|
||||
final String relativeName = extractRelativeName( subZipEntry );
|
||||
final InputStreamAccess inputStreamAccess = buildByteBasedInputStreamAccess( name, jarInputStream );
|
||||
|
||||
final ArchiveEntry entry = new ArchiveEntry() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
final ArchiveEntry entry = new ArchiveEntry() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameWithinArchive() {
|
||||
return relativeName;
|
||||
}
|
||||
@Override
|
||||
public String getNameWithinArchive() {
|
||||
return relativeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStreamAccess getStreamAccess() {
|
||||
return inputStreamAccess;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public InputStreamAccess getStreamAccess() {
|
||||
return inputStreamAccess;
|
||||
}
|
||||
};
|
||||
|
||||
final ArchiveEntryHandler entryHandler = context.obtainArchiveEntryHandler( entry );
|
||||
entryHandler.handleEntry( entry, context );
|
||||
}
|
||||
|
||||
subZipEntry = jarInputStream.getNextEntry();
|
||||
final ArchiveEntryHandler entryHandler = context.obtainArchiveEntryHandler( entry );
|
||||
entryHandler.handleEntry( entry, context );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
|
||||
subZipEntry = jarInputStream.getNextEntry();
|
||||
}
|
||||
}
|
||||
catch (Exception 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