mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-9422 Making sure opened streams are closed
This commit is contained in:
parent
b3e4ba0b62
commit
f96da4e185
@ -139,6 +139,16 @@ private Persistence getPersistence() {
|
|||||||
Diagnostic.Kind.WARNING, "Unable to parse persistence.xml: " + e.getMessage()
|
Diagnostic.Kind.WARNING, "Unable to parse persistence.xml: " + e.getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
catch ( IOException e ) {
|
||||||
|
context.logMessage(
|
||||||
|
Diagnostic.Kind.WARNING, "Unable to close persistence.xml: " + e.getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return persistence;
|
return persistence;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +168,16 @@ private void loadEntityMappings(Collection<String> mappingFileNames) {
|
|||||||
Diagnostic.Kind.WARNING, "Unable to parse " + mappingFile + ": " + e.getMessage()
|
Diagnostic.Kind.WARNING, "Unable to parse " + mappingFile + ": " + e.getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
catch ( IOException e ) {
|
||||||
|
context.logMessage(
|
||||||
|
Diagnostic.Kind.WARNING, "Unable to close '" + mappingFile + "': " + e.getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( mapping != null ) {
|
if ( mapping != null ) {
|
||||||
entityMappings.add( mapping );
|
entityMappings.add( mapping );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user