Buggy code:
public static final int STATE_INVALID = - 1 ; public static final int STATE_NEW = 1 ; public static final int STATE_CONTEXT_MAPPED = 2 ; public static final int STATE_MAPPED = 3 ; protected int serverPort ; protected String remoteAddr ; protected String remoteHost ; protected String localHost ; protected int state ; protected MessageBytes schemeMB = new MessageBytes ( ) ; protected MessageBytes methodMB = new MessageBytes ( ) ; protected MessageBytes uriMB = new MessageBytes ( ) ; protected MessageBytes queryMB = new MessageBytes ( ) ; protected MessageBytes protoMB = new MessageBytes ( ) ; protected MessageBytes contextMB = new MessageBytes ( ) ; protected MessageBytes servletPathMB = new MessageBytes ( ) ; protected MessageBytes pathInfoMB = new MessageBytes ( ) ; protected String jvmRoute ; protected Hashtable attributes = new Hashtable ( ) ; protected MimeHeaders headers ; protected Hashtable parameters = new Hashtable ( ) ; protected boolean didReadFormData ; protected boolean didParameters ; protected int contentLength = - 1 ; protected String contentType = null ; protected String charEncoding = null ; protected MessageBytes serverNameMB = new MessageBytes ( ) ; protected String authType ; boolean notAuthenticated = true ; protected String remoteUser ; protected Principal principal ; protected String [ ] userRoles ; protected String [ ] reqRoles ; protected Response response ; protected ContextManager contextM ; protected Context context ; protected Object requestFacade ; protected String reqSessionId ; protected String sessionIdSource ; protected String sessionId ; protected ServerSession serverSession ; protected Handler handler = null ; Container container ; Cookies scookies ; Request top ; Request parent ; Request child ; Exception errorException ; private Object [ ] notes = new Object [ ContextManager . MAX_NOTES ] ; private Counters cntr = new Counters ( Request . ACCOUNTS ) ; public Request ( ) { } public final int getState ( ) { } final void setState ( int state ) { } public void setContext ( Context context ) { } public Context getContext ( ) { } public void setContextManager ( ContextManager cm ) { } public ContextManager getContextManager ( ) { } public Object getFacade ( ) { } public void setFacade ( Object facade ) { } public void setResponse ( Response response ) { } public Response getResponse ( ) { } public MimeHeaders getMimeHeaders ( ) { } public final Counters getCounters ( ) { } public MessageBytes scheme ( ) { } public MessageBytes method ( ) { } public MessageBytes requestURI ( ) { } public MessageBytes queryString ( ) { } public String getProtocol ( ) { } public void setProtocol ( String protocol ) { } public MessageBytes serverName ( ) { } public int getServerPort ( ) { } public String getRemoteAddr ( ) { } public String getRemoteHost ( ) { } public void setPathInfo ( String pathInfo ) { } public void setServerPort ( int serverPort ) { } public void setRemoteAddr ( String remoteAddr ) { } public void setRemoteHost ( String remoteHost ) { } public String getLocalHost ( ) { } public void setLocalHost ( String host ) { } public String getParameter ( String name ) { } public String [ ] getParameterValues ( String name ) { } public Enumeration getParameterNames ( ) { } public void setAuthType ( String authType ) { } public String getAuthType ( ) { } public String getCharacterEncoding ( ) { } public void setCharEncoding ( String enc ) { } public void setContentLength ( int len ) { } public int getContentLength ( ) { if ( ( contentLength ) > ( - 1 ) ) return contentLength ; MessageBytes clB = headers . getValue ( "content-length" ) ; <START_BUG> contentLength = ( clB == null ) ? - 1 : clB . getInt ( ) ; <END_BUG> return contentLength ; } public String getContentType ( ) { } public void setContentType ( String type ) { } public String getPathInfo ( ) { } public void setRemoteUser ( String s ) { } public String getRemoteUser ( ) { } public boolean isSecure ( ) { } public void setUserPrincipal ( Principal p ) { } public Principal getUserPrincipal ( ) { } public void setRequiredRoles ( String [ ] roles ) { } public String [ ] getRequiredRoles ( ) { } public void setUserRoles ( String [ ] roles ) { } public String [ ] getUserRoles ( ) { } String [ ] checkRoles = new String [ 1 ] ; public boolean isUserInRole ( String role ) { } public String getServletPath ( ) { } public void setServletPath ( String servletPath ) { } public String getJvmRoute ( ) { } public void setJvmRoute ( String jvmRoute ) { } public String getRequestedSessionId ( ) { } public void setRequestedSessionId ( String reqSessionId ) { } public String getSessionIdSource ( ) { } public void setSessionIdSource ( String s ) { } public void setSessionId ( String id ) { } public String getSessionId ( ) { } public void setSession ( ServerSession serverSession ) { } public ServerSession getSession ( boolean create ) { } public Cookies getCookies ( ) { } public Handler getHandler ( ) { } public void setHandler ( Handler handler ) { } public Container getContainer ( ) { } public void setContainer ( Container container ) { } public void setParameters ( Hashtable h ) { } public Hashtable getParameters ( ) { } public Object getAttribute ( String name ) { } public void setAttribute ( String name , Object value ) { } public void removeAttribute ( String name ) { } public Enumeration getAttributeNames ( ) { } public Request getParent ( ) { } public void setParent ( Request req ) { } public Request getChild ( ) { } public void setChild ( Request req ) { } public Request getTop ( ) { }

Fix:
contentLength = ( ( clB == null ) || ( clB . isNull ( ) ) ) ? - 1 : clB . getInt ( ) ;