Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-04-15 08:03:48 -0400
committerAlexander Kurtakov2016-04-15 12:14:25 -0400
commit3dc5c0a138562820c8cefa26b7f864ac4f1a2682 (patch)
treec23854316fc956ab707e25c012bbe7123f247571 /build/org.eclipse.cdt.autotools.core
parent1dd218df31cc4b1748b0469ce2eece4a54193160 (diff)
downloadorg.eclipse.cdt-3dc5c0a138562820c8cefa26b7f864ac4f1a2682.tar.gz
org.eclipse.cdt-3dc5c0a138562820c8cefa26b7f864ac4f1a2682.tar.xz
org.eclipse.cdt-3dc5c0a138562820c8cefa26b7f864ac4f1a2682.zip
autotools; Use try-with-resources.
Change-Id: I424a07664a587ac65210dbe33b96e3f914a1c274 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java24
1 files changed, 6 insertions, 18 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java
index f434247cad..4f6041f66d 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 Red Hat Inc.
+ * Copyright (c) 2010, 2016 Red Hat Inc. 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
@@ -193,15 +193,11 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
* @return
*/
private int getErrorConfigLineNumber(String name) {
- LineNumberReader reader = null;
- try {
- File file = new File(buildDir + "/config.log");
- // If the log file is not present there is nothing we can do.
- if (!file.exists())
- return -1;
-
- reader = new LineNumberReader(new FileReader(file));
-
+ File file = new File(buildDir + "/config.log");
+ // If the log file is not present there is nothing we can do.
+ if (!file.exists())
+ return -1;
+ try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
Pattern errorPattern =
Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
String line;
@@ -213,14 +209,6 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
}
} catch (IOException e) {
return -1;
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // Ignore.
- }
- }
}
return -1;
}

Back to the top