diff --git a/rewrite-core/src/main/java/org/openrewrite/marker/GitProvenance.java b/rewrite-core/src/main/java/org/openrewrite/marker/GitProvenance.java index 4d051b54aa5..73ceafb1411 100644 --- a/rewrite-core/src/main/java/org/openrewrite/marker/GitProvenance.java +++ b/rewrite-core/src/main/java/org/openrewrite/marker/GitProvenance.java @@ -334,8 +334,7 @@ private static List getCommitters(Repository repository) { PersonIdent who = commit.getAuthorIdent(); Committer committer = committers.computeIfAbsent(who.getEmailAddress(), email -> new Committer(who.getName(), email, new TreeMap<>())); - committer.getCommitsByDay().compute(ZonedDateTime - .ofInstant(who.getWhen().toInstant(), who.getTimeZone().toZoneId()) + committer.getCommitsByDay().compute(who.getWhen().toInstant().atZone(who.getTimeZone().toZoneId()) .toLocalDate(), (day, count) -> count == null ? 1 : count + 1); } diff --git a/rewrite-xml/src/main/java/org/openrewrite/xml/security/AddOwaspDateBoundSuppressions.java b/rewrite-xml/src/main/java/org/openrewrite/xml/security/AddOwaspDateBoundSuppressions.java index 67384c228d8..deb23da86f3 100644 --- a/rewrite-xml/src/main/java/org/openrewrite/xml/security/AddOwaspDateBoundSuppressions.java +++ b/rewrite-xml/src/main/java/org/openrewrite/xml/security/AddOwaspDateBoundSuppressions.java @@ -26,7 +26,6 @@ import org.openrewrite.xml.tree.Xml; import java.time.LocalDate; -import java.time.temporal.ChronoUnit; import java.util.List; @Value @@ -81,7 +80,7 @@ public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext ctx) { } } if (!hasUntil) { - String date = (untilDate != null && !untilDate.isEmpty()) ? untilDate : LocalDate.now().plus(30, ChronoUnit.DAYS).toString(); + String date = (untilDate != null && !untilDate.isEmpty()) ? untilDate : LocalDate.now().plusDays(30).toString(); return t.withAttributes(ListUtils.concat(attributes, autoFormat(new Xml.Attribute(Tree.randomId(), "", Markers.EMPTY, new Xml.Ident(Tree.randomId(), "", Markers.EMPTY, "until"), "", diff --git a/rewrite-xml/src/main/java/org/openrewrite/xml/security/RemoveOwaspSuppressions.java b/rewrite-xml/src/main/java/org/openrewrite/xml/security/RemoveOwaspSuppressions.java index 14b00fc7dd6..80a22dc8596 100644 --- a/rewrite-xml/src/main/java/org/openrewrite/xml/security/RemoveOwaspSuppressions.java +++ b/rewrite-xml/src/main/java/org/openrewrite/xml/security/RemoveOwaspSuppressions.java @@ -29,7 +29,6 @@ import java.time.LocalDate; import java.time.format.DateTimeParseException; -import java.time.temporal.ChronoUnit; @Value @EqualsAndHashCode(callSuper = false) @@ -71,7 +70,7 @@ private boolean isPastDueSuppression(Content content) { } try { LocalDate date = LocalDate.parse(maybeDate); - if (date.isBefore(LocalDate.now().minus(1, ChronoUnit.DAYS))) { + if (date.isBefore(LocalDate.now().minusDays(1))) { return true; } } catch (DateTimeParseException e) { diff --git a/rewrite-xml/src/main/java/org/openrewrite/xml/security/UpdateOwaspSuppressionDate.java b/rewrite-xml/src/main/java/org/openrewrite/xml/security/UpdateOwaspSuppressionDate.java index 4af83b1725a..055e853e3b2 100644 --- a/rewrite-xml/src/main/java/org/openrewrite/xml/security/UpdateOwaspSuppressionDate.java +++ b/rewrite-xml/src/main/java/org/openrewrite/xml/security/UpdateOwaspSuppressionDate.java @@ -26,7 +26,6 @@ import org.openrewrite.xml.tree.Xml; import java.time.LocalDate; -import java.time.temporal.ChronoUnit; import java.util.List; @Value @@ -90,7 +89,7 @@ public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext ctx) { } } if (hasCve) { - String date = (untilDate != null && !untilDate.isEmpty()) ? untilDate : LocalDate.now().plus(30, ChronoUnit.DAYS).toString(); + String date = (untilDate != null && !untilDate.isEmpty()) ? untilDate : LocalDate.now().plusDays(30).toString(); final String zuluDate = date + "Z"; t = t.withAttributes(ListUtils.map(t.getAttributes(), attr -> { if ("until".equals(attr.getKeyAsString())) {