Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2015-03-05 09:41:23 +0000
committerSarika Sinha2015-03-05 09:41:23 +0000
commit4033dafbeb0b55279a16ddab06d8db5e397f7bb2 (patch)
tree3cb931b4a128efea9f14b3334931555829ab35bd /org.eclipse.debug.examples.core/src_ant/org
parent25611f0b960f8297cf41ec2a2ffe7d49c22209aa (diff)
downloadeclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.tar.gz
eclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.tar.xz
eclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.zip
Bug 461219 - Compile warnings in official buildI20150305-1200
Diffstat (limited to 'org.eclipse.debug.examples.core/src_ant/org')
-rw-r--r--org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java21
1 files changed, 3 insertions, 18 deletions
diff --git a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
index d51bba239..3f6f99350 100644
--- a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
+++ b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -164,20 +164,10 @@ public class PreProcessor extends Task {
}
} else {
// write new file
- FileWriter writer = null;
- try {
- writer = new FileWriter(destFile);
+ try (FileWriter writer = new FileWriter(destFile)) {
writer.write(contents);
} catch (IOException e) {
throw new BuildException(e);
- } finally {
- try {
- if (writer != null) {
- writer.close();
- }
- } catch (IOException e) {
- throw new BuildException(e);
- }
}
}
}
@@ -191,11 +181,9 @@ public class PreProcessor extends Task {
*/
public String preProcessFile(File srcFile, String strip) {
try {
- FileReader fileReader = new FileReader(srcFile);
- BufferedReader reader = new BufferedReader(fileReader);
boolean changed = false;
StringBuffer buffer = new StringBuffer();
- try {
+ try (FileReader fileReader = new FileReader(srcFile); BufferedReader reader = new BufferedReader(fileReader)) {
String line = reader.readLine();
String activeSymbol = null;
int state = STATE_OUTSIDE_CONDITION;
@@ -283,9 +271,6 @@ public class PreProcessor extends Task {
line = reader.readLine();
}
}
- finally {
- reader.close();
- }
if (!changed) {
return null;
}

Back to the top