mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Fix warnings in tests.dsf.gdb.
Change-Id: I9cee87128ad23c1febca3d99206024e9a157524b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
4df4725967
commit
5e6ca30126
4 changed files with 58 additions and 73 deletions
|
@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.cdt.dsf.gdb,
|
||||
org.eclipse.core.variables,
|
||||
org.mockito,
|
||||
org.hamcrest
|
||||
org.hamcrest.library
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ClassPath: .
|
||||
|
|
|
@ -2945,10 +2945,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
|
|||
IExpressionDMAddress addr = (IExpressionDMAddress) wait.getReturnInfo();
|
||||
|
||||
assertTrue("Unable to get address", addr != null);
|
||||
if (addr != null) {
|
||||
assertTrue("Received wrong address of " + addr.toString() + " instead of (" + actualAddrStr + ", "
|
||||
+ actualAddrSize + ")", addressesEqual(addr, actualAddrStr, actualAddrSize));
|
||||
}
|
||||
assertTrue("Received wrong address of " + addr.toString() + " instead of (" + actualAddrStr + ", "
|
||||
+ actualAddrSize + ")", addressesEqual(addr, actualAddrStr, actualAddrSize));
|
||||
}
|
||||
|
||||
private void doTestChildren(IExpressionDMContext exprDMC) throws Throwable {
|
||||
|
|
|
@ -133,42 +133,36 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
|
|||
// that is relative to the working directory.
|
||||
File file = new File(EXEC_PATH + EXEC_NAME);
|
||||
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
try (FileInputStream fis = new FileInputStream(file);) {
|
||||
|
||||
final String MATCH = "cygwin1.dll";
|
||||
final int MATCH_LEN = MATCH.length();
|
||||
int i = 0;
|
||||
int ch = 0;
|
||||
while (true) {
|
||||
try {
|
||||
ch = fis.read();
|
||||
} catch (IOException e) {
|
||||
Assert.fail("Problem inspecting file to see if it's a cygwin executable : "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
if (ch == -1) { // EOF
|
||||
break;
|
||||
}
|
||||
if (ch == MATCH.charAt(i)) {
|
||||
if (i == MATCH_LEN - 1) {
|
||||
break; // found it!
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Assert.fail(e.getLocalizedMessage());
|
||||
return; // needed to avoid warning at fis usage below
|
||||
}
|
||||
|
||||
final String MATCH = "cygwin1.dll";
|
||||
final int MATCH_LEN = MATCH.length();
|
||||
int i = 0;
|
||||
int ch = 0;
|
||||
while (true) {
|
||||
try {
|
||||
ch = fis.read();
|
||||
} catch (IOException e) {
|
||||
Assert.fail(
|
||||
"Problem inspecting file to see if it's a cygwin executable : " + e.getLocalizedMessage());
|
||||
}
|
||||
if (ch == -1) { // EOF
|
||||
break;
|
||||
}
|
||||
if (ch == MATCH.charAt(i)) {
|
||||
if (i == MATCH_LEN - 1) {
|
||||
break; // found it!
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return; // needed to avoid warning at fis usage
|
||||
} catch (IOException e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,43 +152,36 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
// that is relative to the working directory.
|
||||
File file = new File(EXEC_PATH + EXEC_NAME);
|
||||
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
try (FileInputStream fis = new FileInputStream(file);) {
|
||||
final String MATCH = "cygwin1.dll";
|
||||
final int MATCH_LEN = MATCH.length();
|
||||
int i = 0;
|
||||
int ch = 0;
|
||||
while (true) {
|
||||
try {
|
||||
ch = fis.read();
|
||||
} catch (IOException e) {
|
||||
Assert.fail("Problem inspecting file to see if it's a cygwin executable : "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
if (ch == -1) { // EOF
|
||||
break;
|
||||
}
|
||||
if (ch == MATCH.charAt(i)) {
|
||||
if (i == MATCH_LEN - 1) {
|
||||
sProgramIsCygwin = true;
|
||||
break; // found it!
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Assert.fail(e.getLocalizedMessage());
|
||||
return; // needed to avoid warning at fis usage below
|
||||
}
|
||||
|
||||
final String MATCH = "cygwin1.dll";
|
||||
final int MATCH_LEN = MATCH.length();
|
||||
int i = 0;
|
||||
int ch = 0;
|
||||
while (true) {
|
||||
try {
|
||||
ch = fis.read();
|
||||
} catch (IOException e) {
|
||||
Assert.fail(
|
||||
"Problem inspecting file to see if it's a cygwin executable : " + e.getLocalizedMessage());
|
||||
}
|
||||
if (ch == -1) { // EOF
|
||||
break;
|
||||
}
|
||||
if (ch == MATCH.charAt(i)) {
|
||||
if (i == MATCH_LEN - 1) {
|
||||
sProgramIsCygwin = true;
|
||||
break; // found it!
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue