Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecsilva committed Oct 14, 2024
1 parent 257eaf8 commit d0ead4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ public CodemodFileScanningResult remediateAll(
List<CodemodChange> allChanges = new ArrayList<>();
List<UnfixedFinding> allUnfixed = new ArrayList<>();

for (var searcher : searcherRemediatorMap.keySet()) {
var strategy = searcherRemediatorMap.get(searcher);
for (var searcherAndStrategy : searcherRemediatorMap.entrySet()) {
var pairResult =
remediateWithStrategy(
cu,
Expand All @@ -152,8 +151,8 @@ public CodemodFileScanningResult remediateAll(
findingStartLineExtractor,
findingEndLineExtractor,
findingColumnExtractor,
searcher,
strategy);
searcherAndStrategy.getKey(),
searcherAndStrategy.getValue());
allChanges.addAll(pairResult.getValue0());
allUnfixed.addAll(pairResult.getValue1());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.codemodder.DependencyGAV;
import io.codemodder.Either;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;

/**
Expand All @@ -27,14 +28,14 @@ public boolean isSuccess() {

public List<DependencyGAV> getDependencies() {
if (!isSuccess()) {
throw new RuntimeException("Trying to get dependencies from a failure result");
throw new NoSuchElementException("Trying to get dependencies from a failure result");
}
return either.getLeft();
}

public String getReason() {
if (isSuccess()) {
throw new RuntimeException("Trying to get a reason from a successful result");
throw new NoSuchElementException("Trying to get a reason from a successful result");
}
return either.getRight();
}
Expand Down

0 comments on commit d0ead4e

Please sign in to comment.