W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1997

Jigsaw[1.0beta1] & hp_ux java 1.1 & Etag bug

From: <Marko.Happonen@tietogroup.com>
Date: Fri, 14 Nov 1997 11:00:39 +0200
Message-ID: <612432FC0E07D01188A60001FA44B04934F55B@ttvpnt1.vtkk.fi>
To: www-jigsaw@w3.org
Cc: Marko.Happonen@tietogroup.com

> We have encountered a problem with the following combination:
> 
	HP-UX 10.20
	java version "HP-UX Java B.01.12.01 1997/07/31"
	Jigsaw[1.0beta1]

Symptoms:

	When you press 'Refresh' in Html 1.1 capable browser
	(Internet Explorer 4.0), all images disappear from a html page. 
	To get them back again, you must clear the browser cache.

The reason:

	The above seems to be a HP-UX java incompatibility.
	Jigsaw builds an invalid Etag value and sends it to the browser,
	which then sends it back to the Jigsaw server again.
	Unterminated Etag string in the header field 'If-None-Match' 
> 	causes a parsing error.
> 	Jigsaw then breaks the connection and the browser does not
> receive 
	the image.

The solution:

	I traced the problem to the following class:

	w3c\jigsaw\resources\FileResource.java
	
	protected void updateCachedHeaders() {
    	    super.updateCachedHeaders();
          // We only take car eof etag here:
          if ( etag == null ) {
              long lstamp = getFileStamp();
              if ( lstamp >= 0L ) {
                  String soid  = Integer.toString(getOid(), 32);
                  String stamp = Long.toString(lstamp, 32);

                  /*** Added code start ***/
	
			/* Replace all NULL characters in string soid to
			   underlines */

                  byte checkstr[] = soid.getBytes();
                  for ( int i = 0; i < checkstr.length; i++ )
                  {
                      if ( checkstr[i] == 0 )
                          checkstr[i] = '_';
                  }
	            String newsoid = new String(checkstr);
                  if ( ! newsoid.equals(soid) )
                  {
                      // System.out.println("Changed "+ soid +" to "+
newsoid);
                      soid = newsoid;
                  }
                  /*** Added code end ***/

                  etag = HttpFactory.makeETag(false, soid+":"+stamp);
              }
          }
      }

	Method toString(int, int) in class java.lang.Integer seems to
	occasionally return NULL characters inside the string. However
the
	documentation clearly states that it should only return 
	the following ASCII characters:
		-0123456789abcdefghijklmnopqrstuvwxyz
Received on Friday, 14 November 1997 04:01:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:27 GMT