Skip to content

Commit

Permalink
Update BazelLockFileFunction.java
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Nov 25, 2023
1 parent 223dc18 commit 49ffe07
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static BazelLockFileValue getLockfileValue(RootedPath lockfilePath) throw
// Happy path, the lockfile could be parsed and has the correct version.
return bazelLockFileValue;
}
} catch (JsonSyntaxException e1) {
} catch (JsonSyntaxException e) {
// The lockfile is not a valid JSON encoding of a BazelLockFileValue or not valid JSON at
// all. Try to read just the lockfile version to report better messages in error mode.
try (var reader =
Expand All @@ -127,9 +127,13 @@ public static BazelLockFileValue getLockfileValue(RootedPath lockfilePath) throw
Optional.ofNullable(jsonObject.get(LOCK_FILE_VERSION_KEY))
.map(JsonElement::getAsInt)
.orElse(-1);
} catch (NumberFormatException e2) {
} catch (NumberFormatException unused) {
version = -1;
}
if (version == BazelLockFileValue.LOCK_FILE_VERSION) {
// Invalid lockfile, but correct version.
throw e;
}
}
// This is an old version, needs to be updated
// Keep old version to recognize the problem in error mode
Expand Down

0 comments on commit 49ffe07

Please sign in to comment.