Fixed Coverity Issues Reported

This commit is contained in:
Santhosh Edukulla 2014-07-31 16:36:05 +05:30
parent bd3d8286d3
commit 6133bda642
2 changed files with 10 additions and 11 deletions

View File

@ -77,7 +77,7 @@ public class MockSink extends BaseElement {
Object actualValue = buf.getMetadata(key);
if (actualValue == null)
throw new AssertionError("[" + this + "] Incoming buffer #" + packetNumber + " is not equal to expected buffer in metadata for key \"" + key
+ "\".\n Actual metadata value: " + actualValue + ",\n expected value: \"" + expectedValue + "\".");
+ "\".\n Actual metadata value: " + ",\n expected value: \"" + expectedValue + "\".");
if (!expectedValue.equals(actualValue))
throw new AssertionError("[" + this + "] Incoming buffer #" + packetNumber + " is not equal to expected buffer in metadata for key \"" + key

View File

@ -144,18 +144,17 @@ public class ConsoleProxyResourceHandler implements HttpHandler {
}
private static void responseFileContent(HttpExchange t, File f) throws Exception {
OutputStream os = t.getResponseBody();
FileInputStream fis = new FileInputStream(f);
while (true) {
byte[] b = new byte[8192];
int n = fis.read(b);
if (n < 0) {
break;
try(OutputStream os = t.getResponseBody();
FileInputStream fis = new FileInputStream(f);) {
while (true) {
byte[] b = new byte[8192];
int n = fis.read(b);
if (n < 0) {
break;
}
os.write(b, 0, n);
}
os.write(b, 0, n);
}
fis.close();
os.close();
}
private static boolean validatePath(String path) {