CE-881 - Updated what gets caught for file-not-found (presumably an updated apache dep due to POI changed this...)

This commit is contained in:
2024-03-28 08:59:21 -05:00
parent 82e66a159a
commit 9ff5f82a91

View File

@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.nio.file.NoSuchFileException;
import java.util.Optional; import java.util.Optional;
import com.kingsrook.qqq.backend.core.logging.QLogger; import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.utils.JsonUtils; import com.kingsrook.qqq.backend.core.utils.JsonUtils;
@ -98,14 +99,14 @@ public class TempFileStateProvider implements StateProviderInterface
String json = FileUtils.readFileToString(getFile(key)); String json = FileUtils.readFileToString(getFile(key));
return (Optional.of(JsonUtils.toObject(json, type))); return (Optional.of(JsonUtils.toObject(json, type)));
} }
catch(FileNotFoundException fnfe) catch(FileNotFoundException | NoSuchFileException fnfe)
{ {
return (Optional.empty()); return (Optional.empty());
} }
catch(IOException e) catch(IOException e)
{ {
LOG.error("Error getting state from file", e); LOG.error("Error getting state from file", e);
throw (new RuntimeException("Error retreiving state", e)); throw (new RuntimeException("Error retrieving state", e));
} }
} }