Issue #2384 - fixed try/catch/finally
Former-commit-id:b9e2d6c605
[formerlyf4ee04c905
[formerly 696e7297f7130ff5486e947b179e3bb0f2eaaabd]] Former-commit-id:f4ee04c905
Former-commit-id:9875aba51b
This commit is contained in:
parent
6328d1ebb2
commit
6fcbc04f2e
1 changed files with 28 additions and 23 deletions
|
@ -119,32 +119,37 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
private void createImage(Composite mainComposite) {
|
||||
|
||||
InputStream is = null;
|
||||
|
||||
ClassLoader cl = WarnGenConfirmationDlg.class.getClassLoader();
|
||||
|
||||
if (mode.equals(CAVEMode.OPERATIONAL)) {
|
||||
// add Live image
|
||||
is = cl.getResourceAsStream(IMAGE_OPERATIONAL);
|
||||
} else if (mode.equals(CAVEMode.TEST)) {
|
||||
// add Test image
|
||||
is = cl.getResourceAsStream(IMAGE_TEST);
|
||||
} else if (mode.equals(CAVEMode.PRACTICE)) {
|
||||
// add Practice image
|
||||
is = cl.getResourceAsStream(IMAGE_PRACTICE);
|
||||
} else {
|
||||
// unknown
|
||||
is = cl.getResourceAsStream(IMAGE_OPERATIONAL);
|
||||
}
|
||||
|
||||
stopSign = new Image(mainComposite.getDisplay(), is);
|
||||
Label stopSignLbl = new Label(mainComposite, 0);
|
||||
stopSignLbl.setImage(stopSign);
|
||||
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
ClassLoader cl = WarnGenConfirmationDlg.class.getClassLoader();
|
||||
|
||||
if (mode.equals(CAVEMode.OPERATIONAL)) {
|
||||
// add Live image
|
||||
is = cl.getResourceAsStream(IMAGE_OPERATIONAL);
|
||||
} else if (mode.equals(CAVEMode.TEST)) {
|
||||
// add Test image
|
||||
is = cl.getResourceAsStream(IMAGE_TEST);
|
||||
} else if (mode.equals(CAVEMode.PRACTICE)) {
|
||||
// add Practice image
|
||||
is = cl.getResourceAsStream(IMAGE_PRACTICE);
|
||||
} else {
|
||||
// unknown
|
||||
is = cl.getResourceAsStream(IMAGE_OPERATIONAL);
|
||||
}
|
||||
|
||||
stopSign = new Image(mainComposite.getDisplay(), is);
|
||||
Label stopSignLbl = new Label(mainComposite, 0);
|
||||
stopSignLbl.setImage(stopSign);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue