diff src/org/eclipse/jetty/http/HttpGenerator.java @ 1064:a0abb16cf6e7

remove JBuffer.readFrom()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 09 Nov 2016 03:09:37 -0700
parents 013939bfc9e8
children 158d1e6ac17f
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpGenerator.java	Wed Nov 09 02:08:33 2016 -0700
+++ b/src/org/eclipse/jetty/http/HttpGenerator.java	Wed Nov 09 03:09:37 2016 -0700
@@ -200,34 +200,32 @@
 	 * @return the available space in the buffer.
 	 * @throws IOException
 	 */
-	public int prepareUncheckedAddContent() throws IOException
+	public void prepareUncheckedAddContent() throws IOException
 	{
 		if (_noContent)
-			return -1;
+//			return -1;
+			throw new RuntimeException("_noContent");
 
 		if (_last || _state==STATE_END)
-			return -1;
+//			return -1;
+			throw new RuntimeException("_last");
 
 		// Handle any unfinished business?
-		JBuffer content = _content;
-		if (content != null && content.remaining()>0 || _bufferChunked)
+		if (_content != null && _content.remaining()>0 || _bufferChunked)
 		{
 			flushBuffer();
-			if (content != null && content.remaining()>0 || _bufferChunked)
+			if (_content != null && _content.remaining()>0 || _bufferChunked)
 				throw new IllegalStateException("FULL");
 		}
 
-		// we better check we have a buffer
-		if (_buffer == null)
-			_buffer = _buffers.getBuffer();
-
-		_contentWritten-=_buffer.remaining();
-
+		_contentWritten -= _buffer.remaining();
+/*
 		// Handle the _content
 		if (_head)
 			return Integer.MAX_VALUE;
 
 		return _buffer.space();
+*/
 	}
 
 	public boolean isBufferFull()
@@ -976,6 +974,8 @@
 
 	public final JBuffer getUncheckedBuffer()
 	{
+		if (_buffer == null)
+			_buffer = _buffers.getBuffer();
 		return _buffer;
 	}
 
@@ -1064,17 +1064,9 @@
 
 	public final void completeUncheckedAddContent()
 	{
-		if (_noContent)
-		{
-			if(_buffer!=null)
-				_buffer.clear();
-		}
-		else
-		{
-			_contentWritten += _buffer.remaining();
-			if (_head)
-				_buffer.clear();
-		}
+		_contentWritten += _buffer.remaining();
+		if (_head)
+			_buffer.clear();
 	}
 
 	private boolean isBufferFull2()