1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

autotools; Use try-with-resources.

Change-Id: I424a07664a587ac65210dbe33b96e3f914a1c274
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2016-04-15 15:03:48 +03:00
parent 1dd218df31
commit 3dc5c0a138

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -193,15 +193,11 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
* @return * @return
*/ */
private int getErrorConfigLineNumber(String name) { private int getErrorConfigLineNumber(String name) {
LineNumberReader reader = null;
try {
File file = new File(buildDir + "/config.log"); File file = new File(buildDir + "/config.log");
// If the log file is not present there is nothing we can do. // If the log file is not present there is nothing we can do.
if (!file.exists()) if (!file.exists())
return -1; return -1;
try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
reader = new LineNumberReader(new FileReader(file));
Pattern errorPattern = Pattern errorPattern =
Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$ Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
String line; String line;
@ -213,14 +209,6 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
} }
} catch (IOException e) { } catch (IOException e) {
return -1; return -1;
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore.
}
}
} }
return -1; return -1;
} }