Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse')
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
index d799e50bf..caa7fea92 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
@@ -127,10 +127,8 @@ public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
}
private int findLine(IFile file, String var) throws CoreException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
-
int lineNum = 0;
- try {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()))) {
while(true) {
String line = reader.readLine().trim();
if (line.startsWith("var")) { //$NON-NLS-1$
@@ -144,12 +142,8 @@ public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
} catch (IOException e) {
// end of file reached and line wasn't found
return -1;
- } finally {
- try {
- reader.close();
- } catch (IOException e) {}
- }
- return lineNum;
+ }
+ return lineNum;
}
/* (non-Javadoc)

Back to the top