mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02: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);
|
Object actualValue = buf.getMetadata(key);
|
||||||
if (actualValue == null)
|
if (actualValue == null)
|
||||||
throw new AssertionError("[" + this + "] Incoming buffer #" + packetNumber + " is not equal to expected buffer in metadata for key \"" + key
|
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))
|
if (!expectedValue.equals(actualValue))
|
||||||
throw new AssertionError("[" + this + "] Incoming buffer #" + packetNumber + " is not equal to expected buffer in metadata for key \"" + key
|
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 {
|
private static void responseFileContent(HttpExchange t, File f) throws Exception {
|
||||||
OutputStream os = t.getResponseBody();
|
try(OutputStream os = t.getResponseBody();
|
||||||
FileInputStream fis = new FileInputStream(f);
|
FileInputStream fis = new FileInputStream(f);) {
|
||||||
while (true) {
|
while (true) {
|
||||||
byte[] b = new byte[8192];
|
byte[] b = new byte[8192];
|
||||||
int n = fis.read(b);
|
int n = fis.read(b);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
os.write(b, 0, n);
|
||||||
}
|
}
|
||||||
os.write(b, 0, n);
|
|
||||||
}
|
}
|
||||||
fis.close();
|
|
||||||
os.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean validatePath(String path) {
|
private static boolean validatePath(String path) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user