handle additional DB closed message on DTO get
This commit is contained in:
+4
-1
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -189,7 +189,15 @@ public abstract class AbstractDhRepo<TKey, TDTO extends IBaseDTO<TKey>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user