Add logging/messaging for corrupted DB files

This commit is contained in:
James Seibel
2025-12-09 07:12:33 -06:00
parent 5ca754d2ac
commit 26d4220967
26 changed files with 171 additions and 78 deletions
@@ -25,6 +25,7 @@ import com.seibel.distanthorizons.core.sql.repo.AbstractDhRepo;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -33,7 +34,7 @@ import java.util.Map;
public class TestCompoundKeyRepo extends AbstractDhRepo<DhChunkPos, TestCompoundKeyDto>
{
public TestCompoundKeyRepo(String databaseType, File databaseFile) throws SQLException
public TestCompoundKeyRepo(String databaseType, File databaseFile) throws SQLException, IOException
{
super(databaseType, databaseFile, TestCompoundKeyDto.class);
@@ -24,6 +24,7 @@ import com.seibel.distanthorizons.core.sql.repo.AbstractDhRepo;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -32,7 +33,7 @@ import java.util.Map;
public class TestPrimaryKeyRepo extends AbstractDhRepo<Integer, TestSingleKeyDto>
{
public TestPrimaryKeyRepo(String databaseType, File databaseFile) throws SQLException
public TestPrimaryKeyRepo(String databaseType, File databaseFile) throws SQLException, IOException
{
super(databaseType, databaseFile, TestSingleKeyDto.class);
@@ -34,6 +34,7 @@ import testItems.sql.TestPrimaryKeyRepo;
import testItems.sql.TestSingleKeyDto;
import java.io.File;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -137,7 +138,7 @@ public class DhRepoSqliteTest
Assert.assertFalse("DTO exists failed", primaryKeyRepo.existsWithKey(insertDto.getKey()));
}
catch (SQLException e)
catch (SQLException | IOException e)
{
Assert.fail(e.getMessage());
}
@@ -200,7 +201,7 @@ public class DhRepoSqliteTest
Assert.assertFalse("DTO exists failed", compoundKeyRepo.existsWithKey(insertDto.getKey()));
}
catch (SQLException e)
catch (SQLException | IOException e)
{
Assert.fail(e.getMessage());
}
@@ -330,7 +331,7 @@ public class DhRepoSqliteTest
Assert.assertNotEquals(0, primaryKeyRepo.openClosables.size());
}
}
catch (SQLException e)
catch (SQLException | IOException e)
{
Assert.fail(e.getMessage());
}
@@ -367,7 +368,7 @@ public class DhRepoSqliteTest
long endMs = System.currentTimeMillis();
System.out.println("Bulk update took ["+(endMs - startMs)+"] ms");
}
catch (SQLException e)
catch (SQLException | IOException e)
{
Assert.fail(e.getMessage());
}