Fix null pointer in DataSourceHandler error handler

This commit is contained in:
James Seibel
2024-12-20 13:49:17 -06:00
parent 0ba030e4aa
commit e6ceba63f7
@@ -150,12 +150,16 @@ public abstract class AbstractDataSourceHandler
}
catch (DataCorruptedException e)
{
// there's a rare issue where the exception doesn't
// have a message, which can cause problems
String message = (e.getMessage() == null) ? e.getMessage() : "No Error message for exception ["+e.getClass().getSimpleName()+"]";
// Only log each message type once.
// This is done to prevent logging "No compression mode with the value [2]" 10,000 times
// if the user is migrating from a nightly build and used ZStd.
if (CORRUPT_DATA_ERRORS_LOGGED.add(e.getMessage()))
if (CORRUPT_DATA_ERRORS_LOGGED.add(message))
{
LOGGER.warn("Corrupted data found at pos [" + DhSectionPos.toString(pos) + "]. Data at position will be deleted so it can be re-generated to prevent issues. Future errors with this same message won't be logged. Error: [" + e.getMessage() + "].", e);
LOGGER.warn("Corrupted data found at pos [" + DhSectionPos.toString(pos) + "]. Data at position will be deleted so it can be re-generated to prevent issues. Future errors with this same message won't be logged. Error: [" + message + "].", e);
}
this.repo.deleteWithKey(pos);
@@ -163,9 +167,6 @@ public abstract class AbstractDataSourceHandler
}
else
{
// TODO does this need any special logic to be populated from the existing DTOs?
// and/or is that necessary?
// Everything already appears to be populating correctly.
dataSource = this.makeEmptyDataSource(pos);
}
}