HHH-14760 Close resource - potential resource leak
Fixes https://hibernate.atlassian.net/browse/HHH-14760
This commit is contained in:
parent
2f166c31df
commit
3be25aa899
|
@ -416,7 +416,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 );
|
||||
|
||||
|
|
|
@ -180,7 +180,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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,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