HHH-9422 Making sure opened streams are closed

This commit is contained in:
Hardy Ferentschik 2014-09-29 15:01:35 +02:00
parent b3e4ba0b62
commit f96da4e185
1 changed files with 20 additions and 0 deletions

View File

@ -139,6 +139,16 @@ public class JpaDescriptorParser {
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;
}
@ -158,6 +168,16 @@ public class JpaDescriptorParser {
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 ) {
entityMappings.add( mapping );
}