Skip to content

Commit 44b7362

Browse files
committed
Log a warning message when the date format is wrong
1 parent 1818e77 commit 44b7362

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/SnapshotTableViewController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ private void takeSnapshot(Consumer<Optional<Snapshot>> consumer) {
247247
snapshot.setSnapshotData(snapshotData);
248248
showSnapshotInTable(snapshot);
249249
if (!Preferences.default_snapshot_name_date_format.isEmpty()) {
250+
String dateFormat = Preferences.default_snapshot_name_date_format;
250251
try {
251252
//The format could be not correct
252-
SimpleDateFormat formatter = new SimpleDateFormat(Preferences.default_snapshot_name_date_format);
253+
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
253254
snapshot.getSnapshotNode().setName(formatter.format(new Date()));
254255
}
255256
catch (Exception e) {
256-
// Do not manage date format
257+
LOGGER.log(Level.WARNING, dateFormat + " is not a valid date format please check 'default_snapshot_name_date_format' preference ", e);
257258
}
258259
}
259260
consumer.accept(Optional.of(snapshot));

0 commit comments

Comments
 (0)