Skip to content

Commit cd10c27

Browse files
style: swapped nested if statement for exception catch
1 parent 3ccfe7a commit cd10c27

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/AttachmentsPreviewController.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,12 @@ public void changed(ObservableValue<? extends Attachment> observable, Attachment
130130
// If there is no app configured for the file type, then use the default configured for the OS/User
131131
try {
132132
if(Desktop.isDesktopSupported()) {
133-
Desktop desktop = Desktop.getDesktop();
134-
if(desktop.isSupported(Desktop.Action.APP_OPEN_FILE)) {
135-
Desktop.getDesktop().open(attachment.getFile());
136-
return;
137-
}
133+
Desktop.getDesktop().open(attachment.getFile());
134+
return;
138135
} else {
139136
ExceptionDetailsErrorDialog.openError(Messages.PreviewOpenErrorTitle, Messages.PreviewOpenErrorBody, null);
140137
}
141-
} catch (IOException e) {
138+
} catch (IOException | UnsupportedOperationException e) {
142139
ExceptionDetailsErrorDialog.openError(Messages.PreviewOpenErrorTitle, Messages.PreviewOpenErrorBody, null);
143140
}
144141
}

0 commit comments

Comments
 (0)