protected void parseURL(URL url,String spec,int start,int limit){
  if (start < limit && spec.charAt(start) == ',') {
    String query=url.getQuery();
    int queryStart=spec.indexOf('?',start);
    if (queryStart != -1) {
      query=spec.substring(queryStart + 1,limit);
      limit=queryStart;
    }
    String path=url.getPath() == null ? "" : url.getPath();
    int param=path.lastIndexOf(';');
    if (param != -1) {
      int comment=path.indexOf(',',param);
      if (comment != -1) {
        path=path.substring(0,comment);
      }
    }
    path+=spec.substring(start,limit);
    setURL(url,url.getProtocol(),url.getHost(),url.getPort(),url.getAuthority(),url.getUserInfo(),path,query,url.getRef());
  }
 else {
    super.parseURL(url,spec,start,limit);
  }
  String path=url.getPath() == null ? "" : url.getPath();
  int semiIndex=path.lastIndexOf(';');
  if (semiIndex < 0) {
    throw new IllegalArgumentException("Message digest parameter is missing");
  }
  int equalsIndex=path.indexOf('=',semiIndex);
  if (equalsIndex < 0) {
    throw new IllegalArgumentException("Message digest parameter is missing a '='");
  }
  String algorithm=path.substring(semiIndex + 1,equalsIndex);
  try {
    MessageDigest.getInstance(algorithm);
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IllegalArgumentException("Message digest parameter algorithm is not found: " + algorithm);
  }
  String digest=path.substring(equalsIndex + 1);
  int comment=digest.indexOf(',');
  if (comment != -1) {
    for (int i=digest.length(); --i > comment; ) {
      char c=digest.charAt(i);
      if (!HttpmdUtil.commentChar(c)) {
        throw new IllegalArgumentException("Comment contains illegal character: '" + c + "'");
      }
    }
    digest=digest.substring(0,comment);
  }
  int length=digest.length();
  if (length == 0) {
    throw new IllegalArgumentException("Message digest parameter digest is empty");
  }
  for (int i=length; --i >= 0; ) {
    char c=digest.charAt(i);
    if (Character.digit(c,16) < 0) {
      throw new IllegalArgumentException("Message digest parameter has invalid hex character: " + c);
    }
  }
}

protected void parseURL ( URL url , String spec , int start , int limit ) { if ( start < limit && spec . charAt ( start ) == ',' ) { String query = url . getQuery ( ) ; int queryStart = spec . indexOf ( '?' , start ) ; if ( queryStart != - 1 ) { query = spec . substring ( queryStart + 1 , limit ) ; limit = queryStart ; } String path = url . getPath ( ) == null ? "" : url . getPath ( ) ; int param = path . lastIndexOf ( ';' ) ; if ( param != - 1 ) { int comment = path . indexOf ( ',' , param ) ; if ( comment != - 1 ) { path = path . substring ( 0 , comment ) ; } } path += spec . substring ( start , limit ) ; setURL ( url , url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , url . getAuthority ( ) , url . getUserInfo ( ) , path , query , url . getRef ( ) ) ; } else { super . parseURL ( url , spec , start , limit ) ; } String path = url . getPath ( ) == null ? "" : url . getPath ( ) ; int semiIndex = path . lastIndexOf ( ';' ) ; if ( semiIndex < 0 ) { throw new IllegalArgumentException ( "Message digest parameter is missing" ) ; } int equalsIndex = path . indexOf ( '=' , semiIndex ) ; if ( equalsIndex < 0 ) { throw new IllegalArgumentException ( "Message digest parameter is missing a '='" ) ; } String algorithm = path . substring ( semiIndex + 1 , equalsIndex ) ; try { MessageDigest . getInstance ( algorithm ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalArgumentException ( "Message digest parameter algorithm is not found: " + algorithm ) ; } String digest = path . substring ( equalsIndex + 1 ) ; int comment = digest . indexOf ( ',' ) ; if ( comment != - 1 ) { for ( int i = digest . length ( ) ; -- i > comment ; ) { char c = digest . charAt ( i ) ; if ( ! HttpmdUtil . commentChar ( c ) ) { throw new IllegalArgumentException ( "Comment contains illegal character: '" + c + "'" ) ; } } digest = digest . substring ( 0 , comment ) ; } int length = digest . length ( ) ; if ( length == 0 ) { throw new IllegalArgumentException ( "Message digest parameter digest is empty" ) ; } for ( int i = length ; -- i >= 0 ; ) { char c = digest . charAt ( i ) ; if ( Character . digit ( c , 16 ) < 0 ) { throw new IllegalArgumentException ( "Message digest parameter has invalid hex character: " + c ) ; } } }
parses the string representation of an httpmd url object .
