Skip to content

Commit

Permalink
better handle IOException when hashing
Browse files Browse the repository at this point in the history
With failing hard drives, other IOExceptions can be raised just from
read(). Handle any of them by deleting or skipping the file.
  • Loading branch information
Adam- committed Oct 30, 2023
1 parent 19f00ae commit b2464da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/net/runelite/launcher/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ private static void download(List<Artifact> artifacts, boolean nodiff) throws IO
{
hash = null;
}
catch (IOException ex)
{
dest.delete();
hash = null;
}

if (Objects.equals(hash, artifact.getHash()))
{
Expand All @@ -608,9 +613,9 @@ private static void download(List<Artifact> artifacts, boolean nodiff) throws IO
{
oldhash = hash(old);
}
catch (FileNotFoundException ex)
catch (IOException ex)
{
oldhash = null;
continue;
}

// Check if old file is valid
Expand Down

0 comments on commit b2464da

Please sign in to comment.