HHH-10715 Unclear excepion handling

This commit is contained in:
Sanne Grinovero 2020-10-10 21:03:49 +01:00
parent b8ddc70ff1
commit 1de234ea93
1 changed files with 17 additions and 13 deletions

View File

@ -218,21 +218,25 @@ public class JpaDescriptorParser {
} }
private FileTimeStampChecker loadTimeStampCache() { private FileTimeStampChecker loadTimeStampCache() {
FileTimeStampChecker serializedTimeStampCheck = new FileTimeStampChecker(); final File file = getSerializationTmpFile();
File file = null; if ( file.exists() ) {
try { try {
file = getSerializationTmpFile(); try ( java.io.FileInputStream fileInputStream = new java.io.FileInputStream( file ) ) {
if ( file.exists() ) { try ( java.io.ObjectInputStream in = new java.io.ObjectInputStream( fileInputStream ) ) {
ObjectInputStream in = new ObjectInputStream( new FileInputStream( file ) ); return (org.hibernate.jpamodelgen.util.FileTimeStampChecker) in.readObject();
serializedTimeStampCheck = (FileTimeStampChecker) in.readObject(); }
in.close(); }
}
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) {