Skip to content

Commit 1818e77

Browse files
committed
Manage a java.lang.IllegalArgumentException: Illegal pattern when
default_snapshot_name_date_format is set to a wrong format
1 parent 0ae9b16 commit 1818e77

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +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-
SimpleDateFormat formatter = new SimpleDateFormat(Preferences.default_snapshot_name_date_format);
251-
snapshot.getSnapshotNode().setName(formatter.format(new Date()));
250+
try {
251+
//The format could be not correct
252+
SimpleDateFormat formatter = new SimpleDateFormat(Preferences.default_snapshot_name_date_format);
253+
snapshot.getSnapshotNode().setName(formatter.format(new Date()));
254+
}
255+
catch (Exception e) {
256+
// Do not manage date format
257+
}
252258
}
253259
consumer.accept(Optional.of(snapshot));
254260
});

0 commit comments

Comments
 (0)