[NO ISSUE][OTH] Avoid NPE on response w/o content-length
Change-Id: Ifac2a5098f3c70348b20b2859d5d2fdddb3d8579
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2902
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
index cfbcad8..70f861c 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
@@ -23,7 +23,6 @@
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
-import io.netty.channel.socket.nio.NioSocketChannel;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -31,6 +30,7 @@
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
+import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.DefaultHttpContent;
import io.netty.handler.codec.http.DefaultHttpResponse;
@@ -93,7 +93,7 @@
statusCode = resp.status().code();
if (msg instanceof DefaultFullHttpResponse) {
lastChunk = true;
- respSize = resp.headers().getInt(HttpHeaderNames.CONTENT_LENGTH);
+ respSize = resp.headers().getInt(HttpHeaderNames.CONTENT_LENGTH, 0);
}
} else if (msg instanceof DefaultHttpContent) {
HttpContent content = (DefaultHttpContent) msg;