Skip to content

Commit 78e9eee

Browse files
committed
Add warnings when metadata cannot be downloaded
1 parent 74b8163 commit 78e9eee

1 file changed

Lines changed: 2 additions & 33 deletions

File tree

rewrite-maven/src/main/java/org/openrewrite/maven/UpgradeDependencyVersion.java

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ public class UpgradeDependencyVersion extends Recipe {
7676
@Nullable
7777
Boolean overrideManagedVersion;
7878

79-
@Option(displayName = "Metadata failure mode",
80-
description = "In the event that metadata for a matching dependency cannot be determined, this option determines how to handle the failure",
81-
example = "fail",
82-
valid = {"ignore", "warn", "fail"},
83-
required = false)
84-
@Nullable
85-
String metadataFailureMode;
86-
8779
@SuppressWarnings("ConstantConditions")
8880
@Override
8981
public Validated validate() {
@@ -236,14 +228,8 @@ public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext ctx) {
236228
}
237229
}
238230
} catch (MavenDownloadingException exception) {
239-
FailureMode failureMode = FailureMode.getFailureMode(metadataFailureMode);
240-
if (failureMode == FailureMode.FAIL) {
241-
throw exception;
242-
} else if (failureMode == FailureMode.IGNORE) {
243-
ctx.getOnError().accept(exception);
244-
} else if (failureMode == FailureMode.WARN) {
245-
return t.withMarkers(t.getMarkers().searchResult(UncaughtVisitorException.getSanitizedStackTrace(exception)));
246-
}
231+
ctx.getOnError().accept(exception);
232+
return t.withMarkers(t.getMarkers().searchResult(UncaughtVisitorException.getSanitizedStackTrace(exception)));
247233
}
248234
return t;
249235
}
@@ -267,21 +253,4 @@ private String findNewerVersion(String groupId, String artifactId, String versio
267253
}
268254
}
269255
}
270-
271-
private enum FailureMode {
272-
IGNORE,
273-
WARN,
274-
FAIL;
275-
276-
private static FailureMode getFailureMode(@Nullable String configuration) {
277-
if ("ignore".equals(configuration)) {
278-
return FailureMode.IGNORE;
279-
} else if ("warn".equals(configuration)) {
280-
return FailureMode.WARN;
281-
} else {
282-
return FailureMode.FAIL;
283-
}
284-
}
285-
}
286-
287256
}

0 commit comments

Comments
 (0)