close errored data sources in full data provider

This commit is contained in:
James Seibel
2025-12-22 08:35:15 -06:00
parent 5cbe5ecfd8
commit 81c533051e
@@ -200,9 +200,10 @@ public class FullDataSourceProviderV2 implements IDebugRenderable, AutoCloseable
return FullDataSourceV2.createEmpty(pos);
}
FullDataSourceV2 dataSource = null;
try
{
FullDataSourceV2 dataSource = this.createDataSourceFromDto(dto);
dataSource = this.createDataSourceFromDto(dto);
// automatically create and save adjacent data if missing
if (dto.dataFormatVersion == FullDataSourceV2DTO.DATA_FORMAT.V1_NO_ADJACENT_DATA)
@@ -221,6 +222,15 @@ public class FullDataSourceProviderV2 implements IDebugRenderable, AutoCloseable
this.tryLogCorruptedDataError(DhSectionPos.toString(pos), e);
this.repo.deleteWithKey(pos);
}
catch (Exception e)
{
if (dataSource != null)
{
dataSource.close();
}
throw e;
}
}
catch (InterruptedException ignore) { }
catch (IOException e)