From 8ae1225fc1685d416642763f306476cac2f5a733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Thu, 15 Jun 2023 16:31:46 +0200 Subject: [PATCH] LogEntry: Convert to legacy Exception - fixes #829 --- .../eclipse/ui/internal/views/log/LogEntry.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogEntry.java b/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogEntry.java index 4e156e3fa48..c36be37dc6a 100644 --- a/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogEntry.java +++ b/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogEntry.java @@ -22,6 +22,7 @@ import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.*; import org.eclipse.core.runtime.IStatus; @@ -245,10 +246,17 @@ public void processEntry(String line) throws ParseException { } } } - Date date = Date.from(Instant.from(GREGORIAN_SDF.parse(dateBuffer.toString()))); - if (date != null) { - fDate = date; - fDateString = LOCAL_SDF.format(fDate.toInstant()); + String stringToParse = dateBuffer.toString(); + try { + Date date = Date.from(Instant.from(GREGORIAN_SDF.parse(stringToParse))); + if (date != null) { + fDate = date; + fDateString = LOCAL_SDF.format(fDate.toInstant()); + } + } catch (DateTimeParseException e) { + ParseException parseException = new ParseException(e.getMessage(), e.getErrorIndex()); + parseException.addSuppressed(e); + throw parseException; } }