Curious verifier error

Nic Ferrier nferrier@tapsellferrier.co.uk
Mon Jan 28 09:29:00 GMT 2002


Here's the method from the ClasspathX servlet API:


  private boolean testConditional(HttpServletRequest request,HttpServletResponse response)
    throws IOException 
  {
    response.setDateHeader("Date",System.currentTimeMillis());
    response.setHeader("Server",getServletConfig().getServletContext().getServerInfo());
    long lastModifiedTime = getLastModified(request);
    if(lastModifiedTime >= 0) 
      {
	response.setDateHeader("Last-Modified",lastModifiedTime);
	long requestModifiedTime = request.getDateHeader("If-Modified-Since");
	if((requestModifiedTime >= 0)
	   &&(requestModifiedTime <= lastModifiedTime )) 
	  {
	    response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
	    return false;
	  }
      }
    return true;
  }


Here's how it's compiled:

  javac -d bin -classpath bin source/javax/servlet/http/HttpServlet.java

(the other classes already exist in bin).

So then do a jcf-dump on this freshly compiled class:

Method name:"testConditional" private Signature: 180=(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)boolean
Attribute "Code", length:155, max_stack:4, max_locals:7, code_length:91
  0: aload_2
  1: ldc #9=<String "Date">
  3: invokestatic #64=<Method java.lang.System.currentTimeMillis ()long>
  6: invokeinterface #99=<InterfaceMethod javax.servlet.http.HttpServletResponse.setDateHeader (java.lang.String,long)void> nargs:4
 11: aload_2


Wierd! I guess that means that the Sun compiler isn't working right.

I'm using version 1.2.2 on linux. I'll try upgrading to 1.3.


Nic



More information about the Java mailing list