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 @@ public class SchemaExport {
|
|||
|
||||
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 @@ public class SchemaUpdate {
|
|||
|
||||
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 @@ public class SchemaValidator {
|
|||
|
||||
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 @@ public class SchemaValidatorTask extends MatchingTask {
|
|||
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 @@ public class JpaDescriptorParser {
|
|||
}
|
||||
|
||||
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…
Reference in New Issue