numerous findbugs inspired cleanups
This commit is contained in:
parent
a82d429e0b
commit
722f390800
|
@ -193,7 +193,7 @@ public class HttpGeneratorClientTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] headers= { "Content-Type","Content-Length","Connection","Transfer-Encoding","Other"};
|
private static final String[] headers= { "Content-Type","Content-Length","Connection","Transfer-Encoding","Other"};
|
||||||
private class TR
|
private static class TR
|
||||||
{
|
{
|
||||||
private String[] values=new String[headers.length];
|
private String[] values=new String[headers.length];
|
||||||
private String body;
|
private String body;
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class HttpGeneratorTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] headers= { "Content-Type","Content-Length","Connection","Transfer-Encoding","Other"};
|
private static final String[] headers= { "Content-Type","Content-Length","Connection","Transfer-Encoding","Other"};
|
||||||
private class TR
|
private static class TR
|
||||||
{
|
{
|
||||||
private int _code;
|
private int _code;
|
||||||
private String _body;
|
private String _body;
|
||||||
|
|
|
@ -46,7 +46,6 @@ public class BufferDateCache extends DateCache
|
||||||
public synchronized Buffer formatBuffer(long date)
|
public synchronized Buffer formatBuffer(long date)
|
||||||
{
|
{
|
||||||
String d = super.format(date);
|
String d = super.format(date);
|
||||||
//noinspection StringEquality
|
|
||||||
if (d==_last)
|
if (d==_last)
|
||||||
return _buffer;
|
return _buffer;
|
||||||
_last=d;
|
_last=d;
|
||||||
|
|
|
@ -462,13 +462,15 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
*/
|
*/
|
||||||
private void updateKey()
|
private void updateKey()
|
||||||
{
|
{
|
||||||
int current_ops=-1;
|
final boolean changed;
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
|
int current_ops=-1;
|
||||||
if (getChannel().isOpen())
|
if (getChannel().isOpen())
|
||||||
{
|
{
|
||||||
boolean read_interest = _readBlocked || (!_dispatched && !_connection.isSuspended());
|
boolean read_interest = _readBlocked || (!_dispatched && !_connection.isSuspended());
|
||||||
boolean write_interest= _writeBlocked || (!_dispatched && !_writable);
|
boolean write_interest= _writeBlocked || (!_dispatched && !_writable);
|
||||||
|
|
||||||
_interestOps =
|
_interestOps =
|
||||||
((!_socket.isInputShutdown() && read_interest ) ? SelectionKey.OP_READ : 0)
|
((!_socket.isInputShutdown() && read_interest ) ? SelectionKey.OP_READ : 0)
|
||||||
| ((!_socket.isOutputShutdown()&& write_interest) ? SelectionKey.OP_WRITE : 0);
|
| ((!_socket.isOutputShutdown()&& write_interest) ? SelectionKey.OP_WRITE : 0);
|
||||||
|
@ -482,9 +484,10 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
LOG.ignore(e);
|
LOG.ignore(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
changed=_interestOps!=current_ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_interestOps != current_ops)
|
if(changed)
|
||||||
{
|
{
|
||||||
_selectSet.addChange(this);
|
_selectSet.addChange(this);
|
||||||
_selectSet.wakeup();
|
_selectSet.wakeup();
|
||||||
|
|
|
@ -658,7 +658,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
||||||
while (now<end)
|
while (now<end)
|
||||||
{
|
{
|
||||||
process(null,null);
|
process(null,null);
|
||||||
synchronized (this)
|
synchronized (SslConnection.this)
|
||||||
{
|
{
|
||||||
if (_unwrapBuf!=null && _unwrapBuf.hasContent())
|
if (_unwrapBuf!=null && _unwrapBuf.hasContent())
|
||||||
break;
|
break;
|
||||||
|
@ -789,9 +789,16 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
Buffer i=_inbound;
|
Buffer i;
|
||||||
Buffer o=_outbound;
|
Buffer o;
|
||||||
Buffer u=_unwrapBuf;
|
Buffer u;
|
||||||
|
|
||||||
|
synchronized(SslConnection.this)
|
||||||
|
{
|
||||||
|
i=_inbound;
|
||||||
|
o=_outbound;
|
||||||
|
u=_unwrapBuf;
|
||||||
|
}
|
||||||
return "SSL:"+_endp+" "+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length()+(_oshut?" oshut":""));
|
return "SSL:"+_endp+" "+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length()+(_oshut?" oshut":""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,11 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public void join() throws InterruptedException
|
public void join() throws InterruptedException
|
||||||
{
|
{
|
||||||
Thread[] threads = _acceptorThread;
|
Thread[] threads;
|
||||||
|
synchronized(this)
|
||||||
|
{
|
||||||
|
threads= _acceptorThread;
|
||||||
|
}
|
||||||
if (threads != null)
|
if (threads != null)
|
||||||
for (int i = 0; i < threads.length; i++)
|
for (int i = 0; i < threads.length; i++)
|
||||||
if (threads[i] != null)
|
if (threads[i] != null)
|
||||||
|
|
|
@ -629,7 +629,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
|
||||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws Exception
|
protected synchronized void doStart() throws Exception
|
||||||
{
|
{
|
||||||
if (_logDateFormat != null)
|
if (_logDateFormat != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -576,7 +576,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
||||||
*/
|
*/
|
||||||
public boolean isShutdown()
|
public boolean isShutdown()
|
||||||
{
|
{
|
||||||
return !_shutdown;
|
synchronized (this)
|
||||||
|
{
|
||||||
|
return !_shutdown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -602,7 +605,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
||||||
*/
|
*/
|
||||||
public boolean isAvailable()
|
public boolean isAvailable()
|
||||||
{
|
{
|
||||||
return _available;
|
synchronized (this)
|
||||||
|
{
|
||||||
|
return _available;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -666,7 +672,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
||||||
// defers the calling of super.doStart()
|
// defers the calling of super.doStart()
|
||||||
startContext();
|
startContext();
|
||||||
|
|
||||||
_availability = _shutdown?__SHUTDOWN:_available?__AVAILABLE:__UNAVAILABLE;
|
synchronized(this)
|
||||||
|
{
|
||||||
|
_availability = _shutdown?__SHUTDOWN:_available?__AVAILABLE:__UNAVAILABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,10 +110,6 @@ public class DefaultHandler extends AbstractHandler
|
||||||
response.setContentType(MimeTypes.TEXT_HTML);
|
response.setContentType(MimeTypes.TEXT_HTML);
|
||||||
|
|
||||||
ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500);
|
ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500);
|
||||||
|
|
||||||
String uri=request.getRequestURI();
|
|
||||||
uri=StringUtil.replace(uri,"<","<");
|
|
||||||
uri=StringUtil.replace(uri,">",">");
|
|
||||||
|
|
||||||
writer.write("<HTML>\n<HEAD>\n<TITLE>Error 404 - Not Found");
|
writer.write("<HTML>\n<HEAD>\n<TITLE>Error 404 - Not Found");
|
||||||
writer.write("</TITLE>\n<BODY>\n<H2>Error 404 - Not Found.</H2>\n");
|
writer.write("</TITLE>\n<BODY>\n<H2>Error 404 - Not Found.</H2>\n");
|
||||||
|
|
|
@ -281,9 +281,9 @@ public class GzipHandler extends HandlerWrapper
|
||||||
return new GzipResponseWrapper(request, response)
|
return new GzipResponseWrapper(request, response)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
setMimeTypes(GzipHandler.this._mimeTypes);
|
super.setMimeTypes(GzipHandler.this._mimeTypes);
|
||||||
setBufferSize(GzipHandler.this._bufferSize);
|
super.setBufferSize(GzipHandler.this._bufferSize);
|
||||||
setMinGzipSize(GzipHandler.this._minGzipSize);
|
super.setMinGzipSize(GzipHandler.this._minGzipSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -100,12 +100,6 @@ public class MovedContextHandler extends ContextHandler
|
||||||
{
|
{
|
||||||
if (_newContextURL==null)
|
if (_newContextURL==null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String url = _newContextURL;
|
|
||||||
if (!_discardPathInfo && request.getPathInfo()!=null)
|
|
||||||
url=URIUtil.addPaths(url, request.getPathInfo());
|
|
||||||
if (!_discardQuery && request.getQueryString()!=null)
|
|
||||||
url+="?"+request.getQueryString();
|
|
||||||
|
|
||||||
String path=_newContextURL;
|
String path=_newContextURL;
|
||||||
if (!_discardPathInfo && request.getPathInfo()!=null)
|
if (!_discardPathInfo && request.getPathInfo()!=null)
|
||||||
|
@ -117,7 +111,9 @@ public class MovedContextHandler extends ContextHandler
|
||||||
if (!_discardQuery && request.getQueryString()!=null)
|
if (!_discardQuery && request.getQueryString()!=null)
|
||||||
{
|
{
|
||||||
location.append('?');
|
location.append('?');
|
||||||
location.append(request.getQueryString());
|
String q=request.getQueryString();
|
||||||
|
q=q.replaceAll("\r\n?&=","!");
|
||||||
|
location.append(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setHeader(HttpHeaders.LOCATION,location.toString());
|
response.setHeader(HttpHeaders.LOCATION,location.toString());
|
||||||
|
|
|
@ -309,7 +309,6 @@ public class ResourceHandler extends AbstractHandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
included = Boolean.FALSE;
|
|
||||||
servletPath = request.getServletPath();
|
servletPath = request.getServletPath();
|
||||||
pathInfo = request.getPathInfo();
|
pathInfo = request.getPathInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class BlockingChannelConnector extends AbstractNIOConnector
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
close();
|
super.close();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,7 @@ public class BlockingChannelConnector extends AbstractNIOConnector
|
||||||
if (!getThreadPool().dispatch(this))
|
if (!getThreadPool().dispatch(this))
|
||||||
{
|
{
|
||||||
LOG.warn("dispatch failed for {}",_connection);
|
LOG.warn("dispatch failed for {}",_connection);
|
||||||
BlockingChannelEndPoint.this.close();
|
super.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,13 +302,17 @@ public class BlockingChannelConnector extends AbstractNIOConnector
|
||||||
catch (HttpException e)
|
catch (HttpException e)
|
||||||
{
|
{
|
||||||
LOG.debug("BAD", e);
|
LOG.debug("BAD", e);
|
||||||
try{BlockingChannelEndPoint.this.close();}
|
try{super.close();}
|
||||||
catch(IOException e2){LOG.ignore(e2);}
|
catch(IOException e2){LOG.ignore(e2);}
|
||||||
}
|
}
|
||||||
|
catch(ThreadDeath e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
{
|
{
|
||||||
LOG.warn("handle failed",e);
|
LOG.warn("handle failed",e);
|
||||||
try{BlockingChannelEndPoint.this.close();}
|
try{super.close();}
|
||||||
catch(IOException e2){LOG.ignore(e2);}
|
catch(IOException e2){LOG.ignore(e2);}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -92,10 +92,15 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
@Override
|
@Override
|
||||||
public void accept(int acceptorID) throws IOException
|
public void accept(int acceptorID) throws IOException
|
||||||
{
|
{
|
||||||
ServerSocketChannel server = _acceptChannel;
|
ServerSocketChannel server;
|
||||||
|
synchronized(this)
|
||||||
|
{
|
||||||
|
server = _acceptChannel;
|
||||||
|
}
|
||||||
|
|
||||||
if (server!=null && server.isOpen() && _manager.isStarted())
|
if (server!=null && server.isOpen() && _manager.isStarted())
|
||||||
{
|
{
|
||||||
SocketChannel channel = _acceptChannel.accept();
|
SocketChannel channel = server.accept();
|
||||||
channel.configureBlocking(false);
|
channel.configureBlocking(false);
|
||||||
Socket socket = channel.socket();
|
Socket socket = channel.socket();
|
||||||
configure(socket);
|
configure(socket);
|
||||||
|
@ -141,7 +146,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public Object getConnection()
|
public synchronized Object getConnection()
|
||||||
{
|
{
|
||||||
return _acceptChannel;
|
return _acceptChannel;
|
||||||
}
|
}
|
||||||
|
@ -299,11 +304,15 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
public void dump(Appendable out, String indent) throws IOException
|
public void dump(Appendable out, String indent) throws IOException
|
||||||
{
|
{
|
||||||
out.append(String.valueOf(this)).append("\n");
|
out.append(String.valueOf(this)).append("\n");
|
||||||
ServerSocketChannel channel=_acceptChannel;
|
ServerSocketChannel channel;
|
||||||
|
synchronized (this)
|
||||||
|
{
|
||||||
|
channel=_acceptChannel;
|
||||||
|
}
|
||||||
if (channel==null)
|
if (channel==null)
|
||||||
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{null,"CLOSED",_manager}));
|
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{null,"CLOSED",_manager}));
|
||||||
else
|
else
|
||||||
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{_acceptChannel,_acceptChannel.isOpen()?"OPEN":"CLOSED",_manager}));
|
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{channel,channel.isOpen()?"OPEN":"CLOSED",_manager}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -457,7 +457,10 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
protected void cookieSet()
|
protected void cookieSet()
|
||||||
{
|
{
|
||||||
_cookieSet=_accessed;
|
synchronized (this)
|
||||||
|
{
|
||||||
|
_cookieSet=_accessed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract class AbstractSessionIdManager extends AbstractLifeCycle impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public void setRandom(Random random)
|
public synchronized void setRandom(Random random)
|
||||||
{
|
{
|
||||||
_random=random;
|
_random=random;
|
||||||
_weakRandom=false;
|
_weakRandom=false;
|
||||||
|
|
|
@ -54,8 +54,6 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
|
||||||
OutputStream os=client.getOutputStream();
|
OutputStream os=client.getOutputStream();
|
||||||
InputStream is=client.getInputStream();
|
InputStream is=client.getInputStream();
|
||||||
|
|
||||||
String content="Wibble";
|
|
||||||
byte[] contentB=content.getBytes("utf-8");
|
|
||||||
os.write((
|
os.write((
|
||||||
"GET / HTTP/1.0\r\n"+
|
"GET / HTTP/1.0\r\n"+
|
||||||
"host: "+HOST+":"+_connector.getLocalPort()+"\r\n"+
|
"host: "+HOST+":"+_connector.getLocalPort()+"\r\n"+
|
||||||
|
@ -64,7 +62,7 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String in = IO.toString(is);
|
IO.toString(is);
|
||||||
|
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
assertEquals(-1, is.read());
|
assertEquals(-1, is.read());
|
||||||
|
@ -97,7 +95,7 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String in = IO.toString(is);
|
IO.toString(is);
|
||||||
|
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
assertEquals(-1, is.read());
|
assertEquals(-1, is.read());
|
||||||
|
|
|
@ -151,8 +151,7 @@ public class DumpHandler extends AbstractHandler
|
||||||
String val=request.getParameter("CookieVal");
|
String val=request.getParameter("CookieVal");
|
||||||
val=val.replaceAll("[ \n\r=<>]","?");
|
val=val.replaceAll("[ \n\r=<>]","?");
|
||||||
Cookie cookie=
|
Cookie cookie=
|
||||||
new Cookie(cookie_name.trim(),
|
new Cookie(cookie_name.trim(),val);
|
||||||
request.getParameter("CookieVal"));
|
|
||||||
if ("Clear Cookie".equals(cookie_action))
|
if ("Clear Cookie".equals(cookie_action))
|
||||||
cookie.setMaxAge(0);
|
cookie.setMaxAge(0);
|
||||||
response.addCookie(cookie);
|
response.addCookie(cookie);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class EncodedHttpURITest
|
||||||
{
|
{
|
||||||
String url = "http://www.foo.com/ma\u00F1ana";
|
String url = "http://www.foo.com/ma\u00F1ana";
|
||||||
byte[] asISO = url.getBytes("ISO-8859-1");
|
byte[] asISO = url.getBytes("ISO-8859-1");
|
||||||
String str = new String(asISO, "ISO-8859-1");
|
new String(asISO, "ISO-8859-1");
|
||||||
|
|
||||||
//use a non UTF-8 charset as the encoding and url-escape as per
|
//use a non UTF-8 charset as the encoding and url-escape as per
|
||||||
//http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
|
//http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class HttpConnectionTest
|
||||||
|
|
||||||
int offset=0;
|
int offset=0;
|
||||||
offset = checkContains(response,offset,"HTTP/1.1 200");
|
offset = checkContains(response,offset,"HTTP/1.1 200");
|
||||||
offset = checkContains(response,offset,"/R1");
|
checkContains(response,offset,"/R1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -365,7 +365,7 @@ public class HttpConnectionTest
|
||||||
"5;\015\012"+
|
"5;\015\012"+
|
||||||
"12345\015\012"+
|
"12345\015\012"+
|
||||||
"0;\015\012\015\012");
|
"0;\015\012\015\012");
|
||||||
offset = checkContains(response,offset,"Connection: close");
|
checkContains(response,offset,"Connection: close");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ public class HttpConnectionTest
|
||||||
"Cookie: "+cookie+"\n"+
|
"Cookie: "+cookie+"\n"+
|
||||||
"\015\012"
|
"\015\012"
|
||||||
);
|
);
|
||||||
offset = checkContains(response, offset, "HTTP/1.1 413");
|
checkContains(response, offset, "HTTP/1.1 413");
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -423,7 +423,7 @@ public class HttpConnectionTest
|
||||||
request.append("\015\012");
|
request.append("\015\012");
|
||||||
|
|
||||||
response = connector.getResponses(request.toString());
|
response = connector.getResponses(request.toString());
|
||||||
offset = checkContains(response, offset, "HTTP/1.1 413");
|
checkContains(response, offset, "HTTP/1.1 413");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -469,7 +469,7 @@ public class HttpConnectionTest
|
||||||
"\015\012"
|
"\015\012"
|
||||||
);
|
);
|
||||||
|
|
||||||
offset = checkContains(response, offset, "HTTP/1.1 500");
|
checkContains(response, offset, "HTTP/1.1 500");
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -548,7 +548,7 @@ public class HttpConnectionTest
|
||||||
response=connector.getResponses("CONNECT www.webtide.com:8080 HTTP/1.1\n"+
|
response=connector.getResponses("CONNECT www.webtide.com:8080 HTTP/1.1\n"+
|
||||||
"Host: myproxy:8888\015\012"+
|
"Host: myproxy:8888\015\012"+
|
||||||
"\015\012");
|
"\015\012");
|
||||||
offset = checkContains(response,offset,"HTTP/1.1 200");
|
checkContains(response,offset,"HTTP/1.1 200");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -160,7 +160,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
|
|
||||||
// Read the response.
|
// Read the response.
|
||||||
String response=readResponse(client);
|
String response=readResponse(client);
|
||||||
assertTrue(true); // nothing checked yet.
|
assertTrue (response.indexOf("200")>0);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -556,8 +556,8 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
|
|
||||||
// read and check the times are < 999ms
|
// read and check the times are < 999ms
|
||||||
String[] times=in.readLine().split(",");
|
String[] times=in.readLine().split(",");
|
||||||
|
for (String t: times)
|
||||||
// Assert.assertTrue(Integer.valueOf(t).intValue()<999);
|
Assert.assertTrue(Integer.valueOf(t).intValue()<999);
|
||||||
|
|
||||||
|
|
||||||
// read the EOF chunk
|
// read the EOF chunk
|
||||||
|
@ -587,7 +587,8 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
|
|
||||||
// read and check the times are < 999ms
|
// read and check the times are < 999ms
|
||||||
times=in.readLine().split(",");
|
times=in.readLine().split(",");
|
||||||
//Assert.assertTrue(t,Integer.valueOf(t).intValue()<999);
|
for (String t: times)
|
||||||
|
Assert.assertTrue(t,Integer.valueOf(t).intValue()<999);
|
||||||
|
|
||||||
// check close
|
// check close
|
||||||
Assert.assertTrue(in.readLine()==null);
|
Assert.assertTrue(in.readLine()==null);
|
||||||
|
@ -1060,7 +1061,6 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
AvailableHandler ah=new AvailableHandler();
|
AvailableHandler ah=new AvailableHandler();
|
||||||
configureServer(ah);
|
configureServer(ah);
|
||||||
|
|
||||||
long start=System.currentTimeMillis();
|
|
||||||
Socket client=newSocket(HOST,_connector.getLocalPort());
|
Socket client=newSocket(HOST,_connector.getLocalPort());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class HttpServerTestFixture
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a trust manager that does not validate certificate chains
|
// Create a trust manager that does not validate certificate chains
|
||||||
public static TrustManager[] __trustAllCerts = new TrustManager[] {
|
public final static TrustManager[] __trustAllCerts = new TrustManager[] {
|
||||||
new X509TrustManager(){
|
new X509TrustManager(){
|
||||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -203,7 +203,7 @@ public class HttpServerTestFixture
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static HostnameVerifier __hostnameverifier = new HostnameVerifier()
|
public final static HostnameVerifier __hostnameverifier = new HostnameVerifier()
|
||||||
{
|
{
|
||||||
public boolean verify(String hostname, SSLSession session)
|
public boolean verify(String hostname, SSLSession session)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,7 +160,6 @@ public class ResponseTest
|
||||||
{
|
{
|
||||||
AbstractHttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
AbstractHttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
||||||
|
|
||||||
Request request = connection.getRequest();
|
|
||||||
Response response = connection.getResponse();
|
Response response = connection.getResponse();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,6 @@ public class StressTest
|
||||||
if (__tests.length!=bodies)
|
if (__tests.length!=bodies)
|
||||||
System.err.println("responses=\n"+response+"\n---");
|
System.err.println("responses=\n"+response+"\n---");
|
||||||
assertEquals(name,__tests.length,bodies);
|
assertEquals(name,__tests.length,bodies);
|
||||||
bodies = count(response,"HTTP/1.1 200 OK");
|
|
||||||
|
|
||||||
long bind=connected-start;
|
long bind=connected-start;
|
||||||
long flush=(written-connected)/__tests.length;
|
long flush=(written-connected)/__tests.length;
|
||||||
|
@ -461,7 +460,6 @@ public class StressTest
|
||||||
response.setStatus(200);
|
response.setStatus(200);
|
||||||
response.getOutputStream().print("DATA "+request.getPathInfo()+"\n\n");
|
response.getOutputStream().print("DATA "+request.getPathInfo()+"\n\n");
|
||||||
baseRequest.setHandled(true);
|
baseRequest.setHandled(true);
|
||||||
long end=System.currentTimeMillis();
|
|
||||||
|
|
||||||
_latencies[4].add(new Long(System.currentTimeMillis()-start));
|
_latencies[4].add(new Long(System.currentTimeMillis()-start));
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class SslRenegotiateTest
|
||||||
|
|
||||||
private void doWrap() throws Exception
|
private void doWrap() throws Exception
|
||||||
{
|
{
|
||||||
SSLEngineResult result =_engine.wrap(_outAppB,_outPacketB);
|
_engine.wrap(_outAppB,_outPacketB);
|
||||||
// System.err.println("wrapped "+result.bytesConsumed()+" to "+result.bytesProduced());
|
// System.err.println("wrapped "+result.bytesConsumed()+" to "+result.bytesProduced());
|
||||||
_outPacketB.flip();
|
_outPacketB.flip();
|
||||||
while (_outPacketB.hasRemaining())
|
while (_outPacketB.hasRemaining())
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package org.eclipse.jetty.server.ssl;
|
package org.eclipse.jetty.server.ssl;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -37,6 +38,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -129,6 +131,7 @@ public class SslUploadTest
|
||||||
|
|
||||||
InputStream in = socket.getInputStream();
|
InputStream in = socket.getInputStream();
|
||||||
String response = IO.toString(in);
|
String response = IO.toString(in);
|
||||||
|
assertTrue (response.indexOf("200")>0);
|
||||||
// System.err.println(response);
|
// System.err.println(response);
|
||||||
|
|
||||||
long end = System.nanoTime();
|
long end = System.nanoTime();
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class DateCache
|
||||||
/** Set the timezone.
|
/** Set the timezone.
|
||||||
* @param tz TimeZone
|
* @param tz TimeZone
|
||||||
*/
|
*/
|
||||||
public void setTimeZone(TimeZone tz)
|
public synchronized void setTimeZone(TimeZone tz)
|
||||||
{
|
{
|
||||||
setTzFormatString(tz);
|
setTzFormatString(tz);
|
||||||
if( _locale != null )
|
if( _locale != null )
|
||||||
|
@ -145,7 +145,7 @@ public class DateCache
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private void setTzFormatString(final TimeZone tz )
|
private synchronized void setTzFormatString(final TimeZone tz )
|
||||||
{
|
{
|
||||||
int zIndex = _formatString.indexOf( "ZZZ" );
|
int zIndex = _formatString.indexOf( "ZZZ" );
|
||||||
if( zIndex >= 0 )
|
if( zIndex >= 0 )
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class StringUtil
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public static boolean isUTF8(String charset)
|
public static boolean isUTF8(String charset)
|
||||||
{
|
{
|
||||||
return charset==__UTF8||__UTF8.equalsIgnoreCase(charset)||__UTF8Alt.equalsIgnoreCase(charset);
|
return __UTF8.equalsIgnoreCase(charset)||__UTF8Alt.equalsIgnoreCase(charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
*
|
*
|
||||||
* @see java.net.URLEncoder
|
* @see java.net.URLEncoder
|
||||||
*/
|
*/
|
||||||
public class UrlEncoded extends MultiMap
|
public class UrlEncoded extends MultiMap implements Cloneable
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(UrlEncoded.class);
|
private static final Logger LOG = Log.getLogger(UrlEncoded.class);
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ public class JSON
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void appendJSON(final StringBuffer buffer, Convertible converter)
|
public void appendJSON(final StringBuffer buffer, Convertible converter)
|
||||||
{
|
{
|
||||||
appendJSON((StringBuffer)buffer,converter);
|
appendJSON((Appendable)buffer,converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -151,7 +151,6 @@ public class JarResource extends URLResource
|
||||||
JarInputStream jin = new JarInputStream(is);
|
JarInputStream jin = new JarInputStream(is);
|
||||||
JarEntry entry;
|
JarEntry entry;
|
||||||
boolean shouldExtract;
|
boolean shouldExtract;
|
||||||
String directoryCanonicalPath = directory.getCanonicalPath()+"/";
|
|
||||||
while((entry=jin.getNextJarEntry())!=null)
|
while((entry=jin.getNextJarEntry())!=null)
|
||||||
{
|
{
|
||||||
String entryName = entry.getName();
|
String entryName = entry.getName();
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class JSONPojoConvertorFactoryTest
|
||||||
Map<String,Object> bz = (Map<String,Object>)br.get("baz");
|
Map<String,Object> bz = (Map<String,Object>)br.get("baz");
|
||||||
|
|
||||||
Map<String,Object> f = (Map<String,Object>)bz.get("foo");
|
Map<String,Object> f = (Map<String,Object>)bz.get("foo");
|
||||||
|
assertTrue(f != null);
|
||||||
Object[] bazs = (Object[])br.get("bazs");
|
Object[] bazs = (Object[])br.get("bazs");
|
||||||
assertTrue(bazs.length==2);
|
assertTrue(bazs.length==2);
|
||||||
assertEquals(((Map)bazs[0]).get("message"), "baz0");
|
assertEquals(((Map)bazs[0]).get("message"), "baz0");
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class JSONTest
|
||||||
public void testZeroByte()
|
public void testZeroByte()
|
||||||
{
|
{
|
||||||
String withzero="\u0000";
|
String withzero="\u0000";
|
||||||
String json = JSON.toString(withzero);
|
JSON.toString(withzero);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class LifeCycleListenerTest
|
||||||
lifecycle.stop();
|
lifecycle.stop();
|
||||||
assertFalse("The stopping event occurred", listener.stopping);
|
assertFalse("The stopping event occurred", listener.stopping);
|
||||||
}
|
}
|
||||||
private class TestLifeCycle extends AbstractLifeCycle
|
private static class TestLifeCycle extends AbstractLifeCycle
|
||||||
{
|
{
|
||||||
Exception cause;
|
Exception cause;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue