mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +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();
|
Properties properties = new Properties();
|
||||||
if ( commandLineArgs.propertiesFile != null ) {
|
if ( commandLineArgs.propertiesFile != null ) {
|
||||||
properties.load( new FileInputStream( commandLineArgs.propertiesFile ) );
|
try ( final FileInputStream fis = new FileInputStream( commandLineArgs.propertiesFile ) ) {
|
||||||
|
properties.load( fis );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ssrBuilder.applySettings( properties );
|
ssrBuilder.applySettings( properties );
|
||||||
|
|
||||||
|
@ -179,7 +179,9 @@ private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineA
|
|||||||
|
|
||||||
if ( parsedArgs.propertiesFile != null ) {
|
if ( parsedArgs.propertiesFile != null ) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.load( new FileInputStream( parsedArgs.propertiesFile ) );
|
try ( final FileInputStream fis = new FileInputStream( parsedArgs.propertiesFile ) ) {
|
||||||
|
props.load( fis );
|
||||||
|
}
|
||||||
ssrBuilder.applySettings( props );
|
ssrBuilder.applySettings( props );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,9 @@ private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineA
|
|||||||
|
|
||||||
if ( parsedArgs.propertiesFile != null ) {
|
if ( parsedArgs.propertiesFile != null ) {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.load( new FileInputStream( parsedArgs.propertiesFile ) );
|
try ( final FileInputStream fis = new FileInputStream( parsedArgs.propertiesFile ) ) {
|
||||||
|
properties.load( fis );
|
||||||
|
}
|
||||||
ssrBuilder.applySettings( properties );
|
ssrBuilder.applySettings( properties );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,9 @@ private void configure(StandardServiceRegistryBuilder registryBuilder) throws IO
|
|||||||
properties.putAll( getProject().getProperties() );
|
properties.putAll( getProject().getProperties() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
properties.load( new FileInputStream( propertiesFile ) );
|
try ( final FileInputStream fis = new FileInputStream( propertiesFile ) ) {
|
||||||
|
properties.load( fis );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registryBuilder.applySettings( properties );
|
registryBuilder.applySettings( properties );
|
||||||
|
@ -197,11 +197,9 @@ private boolean mappingFilesUnchanged(Collection<String> mappingFileNames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveTimeStampCache(FileTimeStampChecker fileStampCheck) {
|
private void saveTimeStampCache(FileTimeStampChecker fileStampCheck) {
|
||||||
try {
|
final File file = getSerializationTmpFile();
|
||||||
File file = getSerializationTmpFile();
|
try ( final ObjectOutput out = new ObjectOutputStream( new FileOutputStream( file ) ) ) {
|
||||||
ObjectOutput out = new ObjectOutputStream( new FileOutputStream( file ) );
|
|
||||||
out.writeObject( fileStampCheck );
|
out.writeObject( fileStampCheck );
|
||||||
out.close();
|
|
||||||
context.logMessage(
|
context.logMessage(
|
||||||
Diagnostic.Kind.OTHER, "Serialized " + fileStampCheck + " into " + file.getAbsolutePath()
|
Diagnostic.Kind.OTHER, "Serialized " + fileStampCheck + " into " + file.getAbsolutePath()
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user