mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-06 19:36:03 +00:00
HHH-14760 Close resource - potential resource leak
Fixes https://hibernate.atlassian.net/browse/HHH-14760
This commit is contained in:
parent
42ff387193
commit
c9b8776d3a
@ -414,7 +414,9 @@ private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineA
|
||||
|
||||
Properties properties = new Properties();
|
||||
if ( commandLineArgs.propertiesFile != null ) {
|
||||
properties.load( new FileInputStream( commandLineArgs.propertiesFile ) );
|
||||
try ( final FileInputStream fis = new FileInputStream( commandLineArgs.propertiesFile ) ) {
|
||||
properties.load( fis );
|
||||
}
|
||||
}
|
||||
ssrBuilder.applySettings( properties );
|
||||
|
||||
|
@ -179,7 +179,9 @@ private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineA
|
||||
|
||||
if ( parsedArgs.propertiesFile != null ) {
|
||||
Properties props = new Properties();
|
||||
props.load( new FileInputStream( parsedArgs.propertiesFile ) );
|
||||
try ( final FileInputStream fis = new FileInputStream( parsedArgs.propertiesFile ) ) {
|
||||
props.load( fis );
|
||||
}
|
||||
ssrBuilder.applySettings( props );
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,9 @@ private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineA
|
||||
|
||||
if ( parsedArgs.propertiesFile != null ) {
|
||||
Properties properties = new Properties();
|
||||
properties.load( new FileInputStream( parsedArgs.propertiesFile ) );
|
||||
try ( final FileInputStream fis = new FileInputStream( parsedArgs.propertiesFile ) ) {
|
||||
properties.load( fis );
|
||||
}
|
||||
ssrBuilder.applySettings( properties );
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,9 @@ private void configure(StandardServiceRegistryBuilder registryBuilder) throws IO
|
||||
properties.putAll( getProject().getProperties() );
|
||||
}
|
||||
else {
|
||||
properties.load( new FileInputStream( propertiesFile ) );
|
||||
try ( final FileInputStream fis = new FileInputStream( propertiesFile ) ) {
|
||||
properties.load( fis );
|
||||
}
|
||||
}
|
||||
|
||||
registryBuilder.applySettings( properties );
|
||||
|
@ -197,11 +197,9 @@ private boolean mappingFilesUnchanged(Collection<String> mappingFileNames) {
|
||||
}
|
||||
|
||||
private void saveTimeStampCache(FileTimeStampChecker fileStampCheck) {
|
||||
try {
|
||||
File file = getSerializationTmpFile();
|
||||
ObjectOutput out = new ObjectOutputStream( new FileOutputStream( file ) );
|
||||
final File file = getSerializationTmpFile();
|
||||
try ( final ObjectOutput out = new ObjectOutputStream( new FileOutputStream( file ) ) ) {
|
||||
out.writeObject( fileStampCheck );
|
||||
out.close();
|
||||
context.logMessage(
|
||||
Diagnostic.Kind.OTHER, "Serialized " + fileStampCheck + " into " + file.getAbsolutePath()
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user