Skip to content

Commit

Permalink
Correct accidental moving of method
Browse files Browse the repository at this point in the history
  • Loading branch information
hpmellema committed Sep 18, 2023
1 parent 93f90dd commit 6d9d6bc
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ private ResolvedArtifact(Path path, String coordinates, String groupId, String a
this.shaSum = shaSum != null ? shaSum : getOrComputeSha(path);
}

private static String getOrComputeSha(Path path) {
File artifactFile = path.toFile();
File checksumFile = new File(artifactFile.getParent(), artifactFile.getName() + CHECKSUM_FILE_EXTENSION);
try {
if (checksumFile.exists()) {
return ChecksumUtils.read(checksumFile);
} else {
return DependencyUtils.computeSha1(path);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}

/**
* Creates a resolved artifact from a file path and Maven coordinates string.
*
Expand Down Expand Up @@ -168,20 +182,6 @@ public Node toNode() {
.build();
}

private static String getOrComputeSha(Path path) {
File artifactFile = path.toFile();
File checksumFile = new File(artifactFile.getParent(), artifactFile.getName() + CHECKSUM_FILE_EXTENSION);
try {
if (checksumFile.exists()) {
return ChecksumUtils.read(checksumFile);
} else {
return DependencyUtils.computeSha1(path);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}

private static String[] parseCoordinates(String coordinates) {
String[] parts = coordinates.split(":");
if (parts.length != 3) {
Expand Down

0 comments on commit 6d9d6bc

Please sign in to comment.