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:
parent
1dd218df31
commit
3dc5c0a138
1 changed files with 6 additions and 18 deletions
|
@ -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;
|
File file = new File(buildDir + "/config.log");
|
||||||
try {
|
// If the log file is not present there is nothing we can do.
|
||||||
File file = new File(buildDir + "/config.log");
|
if (!file.exists())
|
||||||
// If the log file is not present there is nothing we can do.
|
return -1;
|
||||||
if (!file.exists())
|
try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
|
||||||
return -1;
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue