StringTokenizer pkgPrefix = new StringTokenizer(propVal, "|");
  private ContentHandler setContentHandler(String contentType)  {    ContentHandler handler;    // No content type so just handle it as the default.    if (contentType == null || contentType.equals(""))      return null;    // See if a handler has been cached for this content type.    // For efficiency, if a content type has been searched for but not    // found, it will be in the hash table but as the contentType String    // instead of a ContentHandler.    if ((handler = (ContentHandler) handlers.get(contentType)) != null)      if (handler instanceof ContentHandler)	return handler;      else	return null;    // If a non-default factory has been set, use it to find the content type.    if (factory != null)      handler = factory.createContentHandler(contentType);    // Non-default factory may have returned null or a factory wasn't set.    // Use the default search algorithm to find a handler for this content type.    if (handler == null)      {	// Get the list of packages to check and append our default handler	// to it, along with the JDK specified default as a last resort.	// Except in very unusual environments the JDK specified one shouldn't	// ever be needed (or available).	String propVal = System.getProperty("java.content.handler.pkgs");	propVal = (propVal == null) ? "" : (propVal + "|");	propVal = propVal + "gnu.gcj.content|sun.net.www.content";	// Replace the '/' character in the content type with '.' and	// all other non-alphabetic, non-numeric characters with '_'.	StringTokenizer pkgPrefix = new StringTokenizer(propVal, "|");	char[] cArray = contentType.toCharArray();	for (int i = 0; i < cArray.length; i++)	  {	    if (cArray[i] == '/')	      cArray[i] = '.';	    else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') || 			(cArray[i] >= 'a' && cArray[i] <= 'z') ||			(cArray[i] >= '0' && cArray[i] <= '9')))	      cArray[i] = '_';	  }	String contentClass = new String(cArray);	// See if a class of this content type exists in any of the packages.	do	  {	    String facName = pkgPrefix.nextToken() + "." + contentClass;	    try	      {		handler =		  (ContentHandler) Class.forName(facName).newInstance();	      }	    catch (Exception e)	      {		// Can't instantiate; handler still null, go on to next element.	      }	  } while ((handler == null ||		    ! (handler instanceof ContentHandler)) &&		   pkgPrefix.hasMoreTokens());      }    // Update the hashtable with the new content handler.    if (handler != null && handler instanceof ContentHandler)      {	handlers.put(contentType, handler);	return handler;      }    // For efficiency on subsequent searches, put a dummy entry in the hash    // table for content types that don't have a non-default ContentHandler.    handlers.put(contentType, contentType);    return null;  }