changeset 1053:7e4b41247544

fix JBuffer.array()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Nov 2016 00:32:02 -0700
parents 4a2489f1d5fe
children 87275900646e
files src/org/eclipse/jetty/http/HttpParser.java src/org/eclipse/jetty/io/JBuffer.java
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
diff -r 4a2489f1d5fe -r 7e4b41247544 src/org/eclipse/jetty/http/HttpParser.java
--- a/src/org/eclipse/jetty/http/HttpParser.java	Tue Nov 08 00:27:16 2016 -0700
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Tue Nov 08 00:32:02 2016 -0700
@@ -290,7 +290,7 @@
 
 			// Handle header states
 			byte ch;
-			byte[] array = _buffer.array();
+			byte[] array = _buffer.hasArray() ? _buffer.array() : null;
 			int last = _state;
 			while (_state<STATE_END && length-->0)
 			{
diff -r 4a2489f1d5fe -r 7e4b41247544 src/org/eclipse/jetty/io/JBuffer.java
--- a/src/org/eclipse/jetty/io/JBuffer.java	Tue Nov 08 00:27:16 2016 -0700
+++ b/src/org/eclipse/jetty/io/JBuffer.java	Tue Nov 08 00:32:02 2016 -0700
@@ -34,7 +34,11 @@
 	}
 
 	public byte[] array() {
-		return bb.hasArray() ? bb.array() : null;
+		return bb.array();
+	}
+
+	public boolean hasArray() {
+		return bb.hasArray();
 	}
 
 	public JBuffer duplicate() {