mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixed Coverity Issues Reported
This commit is contained in:
parent
bd3d8286d3
commit
6133bda642
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user