diff options
author | Sarika Sinha | 2015-03-03 11:30:46 +0000 |
---|---|---|
committer | Sarika Sinha | 2015-03-03 11:30:46 +0000 |
commit | 25611f0b960f8297cf41ec2a2ffe7d49c22209aa (patch) | |
tree | 87156c58215bd21bb8a456eb5ea0f607c6bebc10 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views | |
parent | 9e0b67e5552fec7597bc1da9d9bc705816275409 (diff) | |
download | eclipse.platform.debug-25611f0b960f8297cf41ec2a2ffe7d49c22209aa.tar.gz eclipse.platform.debug-25611f0b960f8297cf41ec2a2ffe7d49c22209aa.tar.xz eclipse.platform.debug-25611f0b960f8297cf41ec2a2ffe7d49c22209aa.zip |
Bug 461219 - Compile warnings in official buildI20150303-0800
Change-Id: I48f14fe5c9ee51a09ede0bc30380cb8e55b5ada2
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views')
3 files changed, 13 insertions, 47 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java index ef2b50f81..016e17432 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -178,10 +178,8 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe DebugUIPlugin.log(e); } if (message != null) { - try { - IOConsoleOutputStream stream = newOutputStream(); + try (IOConsoleOutputStream stream = newOutputStream()) { stream.write(message); - stream.close(); } catch (IOException e) { DebugUIPlugin.log(e); } @@ -203,10 +201,8 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe message = MessageFormat.format(ConsoleMessages.ProcessConsole_3, new Object[] { fStdInFile }); } if (message != null) { - try { - IOConsoleOutputStream stream = newOutputStream(); + try (IOConsoleOutputStream stream = newOutputStream()) { stream.write(message); - stream.close(); } catch (IOException e) { DebugUIPlugin.log(e); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 1d08d4f88..1b924ac76 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -906,18 +906,12 @@ public class LaunchView extends AbstractDebugView IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String string = store.getString(PREF_STATE_MEMENTO); if(string.length() > 0) { - ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); - InputStreamReader reader = new InputStreamReader(bin); - try { + try (ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); InputStreamReader reader = new InputStreamReader(bin)) { XMLMemento stateMemento = XMLMemento.createReadRoot(reader); setMemento(stateMemento); } catch (WorkbenchException e) { - } finally { - try { - reader.close(); - bin.close(); - } catch (IOException e){} - } + } catch (IOException e1) { + } } IMemento mem = getMemento(); @@ -966,10 +960,7 @@ public class LaunchView extends AbstractDebugView public void partDeactivated(IWorkbenchPart part) { String id = part.getSite().getId(); if (id.equals(getSite().getId())) { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - OutputStreamWriter writer = new OutputStreamWriter(bout); - - try { + try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(bout);) { XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$ saveViewerState(memento); memento.save(writer); @@ -978,12 +969,6 @@ public class LaunchView extends AbstractDebugView String xmlString = bout.toString(); store.putValue(PREF_STATE_MEMENTO, xmlString); } catch (IOException e) { - } finally { - try { - writer.close(); - bout.close(); - } catch (IOException e) { - } } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 1e43e7e4a..b9790f1a4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -566,18 +566,12 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String string = store.getString(PREF_STATE_MEMENTO); if(string.length() > 0) { - ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); - InputStreamReader reader = new InputStreamReader(bin); - try { + try (ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); InputStreamReader reader = new InputStreamReader(bin);) { XMLMemento stateMemento = XMLMemento.createReadRoot(reader); setMemento(stateMemento); } catch (WorkbenchException e) { - } finally { - try { - reader.close(); - bin.close(); - } catch (IOException e){} - } + } catch (IOException e1) { + } } IMemento mem = getMemento(); // check the weights to makes sure they are valid -- bug 154025 @@ -619,10 +613,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis public void partDeactivated(IWorkbenchPart part) { String id = part.getSite().getId(); if (id.equals(getSite().getId())) { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - OutputStreamWriter writer = new OutputStreamWriter(bout); - - try { + try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(bout);) { XMLMemento memento = XMLMemento.createWriteRoot("VariablesViewMemento"); //$NON-NLS-1$ saveViewerState(memento); memento.save(writer); @@ -631,12 +622,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis String xmlString = bout.toString(); store.putValue(PREF_STATE_MEMENTO, xmlString); } catch (IOException e) { - } finally { - try { - writer.close(); - bout.close(); - } catch (IOException e) { - } } } super.partDeactivated(part); |