Skip to content

Commit 50ecd42

Browse files
authored
Merge pull request #3322 from katysaintin/master
Manage Illegal pattern Exception on a new Snapshot
2 parents 04c127f + 68939e8 commit 50ecd42

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,15 @@ 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+
String dateFormat = Preferences.default_snapshot_name_date_format;
251+
try {
252+
//The format could be not correct
253+
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
254+
snapshot.getSnapshotNode().setName(formatter.format(new Date()));
255+
}
256+
catch (Exception e) {
257+
LOGGER.log(Level.WARNING, dateFormat + " is not a valid date format please check 'default_snapshot_name_date_format' preference ", e);
258+
}
252259
}
253260
consumer.accept(Optional.of(snapshot));
254261
});

app/save-and-restore/util/src/main/resources/save_and_restore_util_preferences.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------
2-
# Package org.phoebus.applications.saveandrestore
2+
# Package org.phoebus.saveandrestore.util
33
# -----------------------------------------------
44

55
# connection timeout (in ms) when taking snapshot

0 commit comments

Comments
 (0)