HHH-10715 Unclear excepion handling

This commit is contained in:
Sanne Grinovero 2020-10-10 21:03:49 +01:00
parent 1123337bae
commit 93772fe766

View File

@ -218,21 +218,25 @@ private File getSerializationTmpFile() {
} }
private FileTimeStampChecker loadTimeStampCache() { private FileTimeStampChecker loadTimeStampCache() {
FileTimeStampChecker serializedTimeStampCheck = new FileTimeStampChecker(); final File file = getSerializationTmpFile();
File file = null;
try {
file = getSerializationTmpFile();
if ( file.exists() ) { if ( file.exists() ) {
ObjectInputStream in = new ObjectInputStream( new FileInputStream( file ) ); try {
serializedTimeStampCheck = (FileTimeStampChecker) in.readObject(); try ( java.io.FileInputStream fileInputStream = new java.io.FileInputStream( file ) ) {
in.close(); try ( java.io.ObjectInputStream in = new java.io.ObjectInputStream( fileInputStream ) ) {
return (org.hibernate.jpamodelgen.util.FileTimeStampChecker) in.readObject();
}
}
}
catch (java.io.IOException e) {
//handled in the outer scope
}
catch (ClassNotFoundException e) {
//handled in the outer scope
} }
} }
catch (Exception e) {
// ignore - if the de-serialization failed we just have to keep parsing the xml // ignore - if the de-serialization failed we just have to keep parsing the xml
context.logMessage( Diagnostic.Kind.OTHER, "Error de-serializing " + file ); context.logMessage( Diagnostic.Kind.OTHER, "Error de-serializing " + file );
} return new FileTimeStampChecker();
return serializedTimeStampCheck;
} }
private void parseEntities(Collection<Entity> entities, String defaultPackageName) { private void parseEntities(Collection<Entity> entities, String defaultPackageName) {