Skip to content
Browse files

These asserts are mostly broken, prevent them all from use

  • Loading branch information...
1 parent 089a8b7 commit d4f9ff31ab0f7223e50aa8af58a4d4e0fc0ebfdc @n1hility n1hility committed Apr 24, 2012
View
4 src/main/java/org/jboss/sun/net/httpserver/ChunkedInputStream.java
@@ -43,7 +43,7 @@
static char LF = '\n';
private int numeric (char[] arr, int nchars) throws IOException {
- assert arr.length >= nchars;
+ //DISABLED assert arr.length >= nchars;
int len = 0;
for (int i=0; i<nchars; i++) {
char c = arr[i];
@@ -159,7 +159,7 @@ public int available () throws IOException {
* and buffered internally
*/
public boolean isDataBuffered () throws IOException {
- assert eof;
+ //DISABLED assert eof;
return in.available() > 0;
}
View
2 src/main/java/org/jboss/sun/net/httpserver/ChunkedOutputStream.java
@@ -72,7 +72,7 @@ public void write (int b) throws IOException {
if (count == CHUNK_SIZE) {
writeChunk();
}
- assert count < CHUNK_SIZE;
+ //DISABLED assert count < CHUNK_SIZE;
}
public void write (byte[]b, int off, int len) throws IOException {
View
2 src/main/java/org/jboss/sun/net/httpserver/ContextList.java
@@ -34,7 +34,7 @@
LinkedList<HttpContextImpl> list = new LinkedList<HttpContextImpl>();
public synchronized void add (HttpContextImpl ctx) {
- assert ctx.getPath() != null;
+ //DISABLED assert ctx.getPath() != null;
list.add (ctx);
}
View
2 src/main/java/org/jboss/sun/net/httpserver/Event.java
@@ -37,7 +37,7 @@ protected Event (ExchangeImpl t) {
class WriteFinishedEvent extends Event {
WriteFinishedEvent (ExchangeImpl t) {
super (t);
- assert !t.writefinished;
+ //DISABLED assert !t.writefinished;
t.writefinished = true;
}
}
View
4 src/main/java/org/jboss/sun/net/httpserver/ExchangeImpl.java
@@ -425,7 +425,7 @@ public void setAttribute(String name, Object value, HttpExchange.AttributeScope
}
public void setStreams (InputStream i, OutputStream o) {
- assert uis != null;
+ //DISABLED assert uis != null;
if (i != null) {
uis = i;
}
@@ -457,7 +457,7 @@ static ExchangeImpl get (HttpExchange t) {
if (t instanceof HttpExchangeImpl) {
return ((HttpExchangeImpl)t).getExchangeImpl();
} else {
- assert t instanceof HttpsExchangeImpl;
+ //DISABLED assert t instanceof HttpsExchangeImpl;
return ((HttpsExchangeImpl)t).getExchangeImpl();
}
}
View
2 src/main/java/org/jboss/sun/net/httpserver/LeftOverInputStream.java
@@ -56,7 +56,7 @@ public LeftOverInputStream (ExchangeImpl t, InputStream src) {
* if bytes are left over buffered on *the UNDERLYING* stream
*/
public boolean isDataBuffered () throws IOException {
- assert eof;
+ //DISABLED assert eof;
return super.available() > 0;
}
View
4 src/main/java/org/jboss/sun/net/httpserver/Request.java
@@ -261,7 +261,7 @@ public synchronized int read (byte[] b, int off, int srclen) throws IOException
return -1;
}
- assert channel.isBlocking();
+ //DISABLED assert channel.isBlocking();
if (off < 0 || srclen < 0|| srclen > (b.length-off)) {
throw new IndexOutOfBoundsException ();
@@ -357,7 +357,7 @@ public synchronized void reset () throws IOException {
public WriteStream (ServerImpl server, SocketChannel channel) throws IOException {
this.channel = channel;
this.server = server;
- assert channel.isBlocking();
+ //DISABLED assert channel.isBlocking();
closed = false;
one = new byte [1];
buf = ByteBuffer.allocate (4096);
View
10 src/main/java/org/jboss/sun/net/httpserver/SSLStreams.java
@@ -195,7 +195,7 @@ private ByteBuffer allocate (BufType type) {
}
private ByteBuffer allocate (BufType type, int len) {
- assert engine != null;
+ //DISABLED assert engine != null;
synchronized (this) {
int size;
if (type == BufType.PACKET) {
@@ -302,7 +302,7 @@ WrapperResult wrapAndSendX(ByteBuffer src, boolean ignoreClose) throws IOExcepti
if (r.result.bytesProduced() > 0) {
wrap_dst.flip();
int l = wrap_dst.remaining();
- assert l == r.result.bytesProduced();
+ //DISABLED assert l == r.result.bytesProduced();
while (l>0) {
l -= chan.write (wrap_dst);
}
@@ -410,7 +410,7 @@ public WrapperResult sendData (ByteBuffer src) throws IOException {
public WrapperResult recvData (ByteBuffer dst) throws IOException {
/* we wait until some user data arrives */
WrapperResult r = null;
- assert dst.position() == 0;
+ //DISABLED assert dst.position() == 0;
while (dst.position() == 0) {
r = wrapper.recvAndUnwrap (dst);
dst = (r.buf != dst) ? r.buf: dst;
@@ -484,7 +484,7 @@ void doHandshake (HandshakeStatus hs_status) throws IOException {
if (r.buf != tmp) {
tmp = r.buf;
}
- assert tmp.position() == 0;
+ //DISABLED assert tmp.position() == 0;
break;
}
hs_status = r.result.getHandshakeStatus();
@@ -662,7 +662,7 @@ public void close() throws IOException {
r = wrapper.wrapAndSend (buf);
stat = r.result.getHandshakeStatus();
}
- assert r.result.getStatus() == Status.CLOSED;
+ //DISABLED assert r.result.getStatus() == Status.CLOSED;
}
}
}
View
14 src/main/java/org/jboss/sun/net/httpserver/ServerImpl.java
@@ -432,7 +432,7 @@ public void run() {
}
handle (chan, conn);
} else {
- assert false;
+ //DISABLED assert false;
}
} catch (CancelledKeyException e) {
handleException(key, null);
@@ -507,9 +507,9 @@ private void closeConnection(HttpConnection conn) {
idleConnections.remove(conn);
break;
}
- assert !reqConnections.remove(conn);
- assert !rspConnections.remove(conn);
- assert !idleConnections.remove(conn);
+ //DISABLED assert !reqConnections.remove(conn);
+ //DISABLED assert !rspConnections.remove(conn);
+ //DISABLED assert !idleConnections.remove(conn);
}
/* per exchange task */
@@ -796,7 +796,7 @@ synchronized void startExchange () {
synchronized int endExchange () {
exchangeCount --;
- assert exchangeCount >= 0;
+ //DISABLED assert exchangeCount >= 0;
return exchangeCount;
}
@@ -818,7 +818,7 @@ void requestStarted (HttpConnection c) {
// fashion.
void requestCompleted (HttpConnection c) {
- assert c.getState() == State.REQUEST;
+ //DISABLED assert c.getState() == State.REQUEST;
reqConnections.remove (c);
c.rspStartedTime = getTime();
rspConnections.add (c);
@@ -827,7 +827,7 @@ void requestCompleted (HttpConnection c) {
// called after response has been sent
void responseCompleted (HttpConnection c) {
- assert c.getState() == State.RESPONSE;
+ //DISABLED assert c.getState() == State.RESPONSE;
rspConnections.remove (c);
c.setState (State.IDLE);
}

0 comments on commit d4f9ff3

Please sign in to comment.
Something went wrong with that request. Please try again.