Fix a few warnings

This commit is contained in:
James Seibel
2024-04-20 11:38:52 -05:00
parent 37381896bc
commit 382917033a
2 changed files with 19 additions and 21 deletions
@@ -98,9 +98,6 @@ public abstract class AbstractNewDataSourceHandler
protected abstract TDataSource createDataSourceFromDto(TDTO dto) throws InterruptedException, IOException;
protected abstract TDTO createDtoFromDataSource(TDataSource dataSource);
/** Creates a new data source using any DTOs already present in the database. */
protected abstract TDataSource createNewDataSourceFromExistingDtos(DhSectionPos pos);
protected abstract TDataSource makeEmptyDataSource(DhSectionPos pos);
@@ -153,8 +150,10 @@ public abstract class AbstractNewDataSourceHandler
}
else
{
// attempt to create from any existing files
dataSource = this.createNewDataSourceFromExistingDtos(pos);
// 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);
}
}
catch (InterruptedException ignore) { }
@@ -228,29 +227,27 @@ public abstract class AbstractNewDataSourceHandler
updateLock.lock();
this.lockedPosSet.add(updatePos);
}
else
{
methodLocked = false;
}
// get or create the data source
try (TDataSource recipientDataSource = this.get(updatePos))
{
boolean dataModified = recipientDataSource.update(inputData, this.level);
if (dataModified)
if (recipientDataSource != null)
{
// save the updated data to the database
TDTO dto = this.createDtoFromDataSource(recipientDataSource);
this.repo.save(dto);
for (IDataSourceUpdateFunc<TDataSource> listener : this.dateSourceUpdateListeners)
boolean dataModified = recipientDataSource.update(inputData, this.level);
if (dataModified)
{
if (listener != null)
// save the updated data to the database
TDTO dto = this.createDtoFromDataSource(recipientDataSource);
this.repo.save(dto);
for (IDataSourceUpdateFunc<TDataSource> listener : this.dateSourceUpdateListeners)
{
listener.OnDataSourceUpdated(recipientDataSource);
if (listener != null)
{
listener.OnDataSourceUpdated(recipientDataSource);
}
}
}
}
@@ -260,7 +260,8 @@ public class FullDataSourceProviderV2
try (FullDataSourceV2 dataSource = this.get(childPos))
{
if (dataSource != null) // can return null when the file handler is being shut down
// can return null when the file handler is being shut down
if (dataSource != null)
{
this.updateDataSourceAtPos(parentUpdatePos, dataSource, false);
this.repo.setApplyToParent(childPos, false);