diff --git a/core/src/main/java/com/seibel/distanthorizons/core/sql/DbConnectionClosedException.java b/core/src/main/java/com/seibel/distanthorizons/core/sql/DbConnectionClosedException.java index b4e8cffb0..d27a40071 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/sql/DbConnectionClosedException.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/sql/DbConnectionClosedException.java @@ -20,7 +20,10 @@ public class DbConnectionClosedException extends SQLException { // TODO long term we should prevent using repos that are closed, but for now this is the easier solution String message = e.getMessage().toLowerCase(); - return message.contains("connection closed") || message.contains("pointer is closed") || message.contains("database has been closed"); + return message.contains("connection closed") + || message.contains("pointer is closed") + || message.contains("stmt pointer is closed") + || message.contains("database has been closed"); } } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/AbstractDhRepo.java b/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/AbstractDhRepo.java index 49aacfaf0..0559d7fd3 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/AbstractDhRepo.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/AbstractDhRepo.java @@ -189,7 +189,15 @@ public abstract class AbstractDhRepo> implemen } catch (SQLException | IOException e) { - LOGGER.warn("Unexpected issue deserializing DTO ["+this.dtoClass.getSimpleName()+"] with primary key ["+primaryKey+"]. Error: ["+e.getMessage()+"].", e); + if (e instanceof SQLException + && DbConnectionClosedException.IsClosedException((SQLException)e)) + { + //LOGGER.warn("Attempted to get ["+this.dtoClass.getSimpleName()+"] with primary key ["+primaryKey+"] on closed repo ["+this.connectionString+"]."); + } + else + { + LOGGER.warn("Unexpected issue deserializing DTO ["+this.dtoClass.getSimpleName()+"] with primary key ["+primaryKey+"]. Error: ["+e.getMessage()+"].", e); + } return null; } }