HttpmdURLConnection(URL url) throws IOException, MalformedURLException {
  super(url);
  String path=url.getPath() == null ? "" : url.getPath();
  int semiIndex=path.lastIndexOf(';');
  if (semiIndex < 0) {
    throw new MalformedURLException("Message digest parameter is missing");
  }
  int equalsIndex=path.indexOf('=',semiIndex);
  if (equalsIndex < 0) {
    throw new MalformedURLException("Message digest parameter is missing a '='");
  }
  algorithm=path.substring(semiIndex + 1,equalsIndex);
  try {
    MessageDigest.getInstance(algorithm);
  }
 catch (  NoSuchAlgorithmException e) {
    MalformedURLException t=new MalformedURLException("Message digest parameter algorithm is not found: " + algorithm);
    t.initCause(e);
    throw t;
  }
  String digest=path.substring(equalsIndex + 1);
  int comment=digest.indexOf(',');
  if (comment >= 0) {
    for (int i=digest.length(); --i > comment; ) {
      char c=digest.charAt(i);
      if (!HttpmdUtil.commentChar(c)) {
        throw new MalformedURLException("Comment contains illegal character: '" + c + "'");
      }
    }
    digest=digest.substring(0,comment);
  }
  int length=digest.length();
  if (length == 0) {
    throw new MalformedURLException("Message digest parameter digest is empty");
  }
  try {
    expectedDigest=HttpmdUtil.stringDigest(digest);
  }
 catch (  NumberFormatException e) {
    MalformedURLException t=new MalformedURLException("Message digest parameter has invalid format for digest: " + digest);
    t.initCause(e);
    throw t;
  }
  try {
    content=new URL("http",url.getHost(),url.getPort(),path.substring(0,semiIndex) + (url.getQuery() == null ? "" : url.getQuery()) + (url.getRef() == null ? "" : url.getRef()));
  }
 catch (  MalformedURLException e) {
    MalformedURLException t=new MalformedURLException("Problem with content location");
    t.initCause(e);
    throw t;
  }
  delegateConnection=(HttpURLConnection)content.openConnection();
}

HttpmdURLConnection ( URL url ) throws IOException , MalformedURLException { super ( url ) ; String path = url . getPath ( ) == null ? "" : url . getPath ( ) ; int semiIndex = path . lastIndexOf ( ';' ) ; if ( semiIndex < 0 ) { throw new MalformedURLException ( "Message digest parameter is missing" ) ; } int equalsIndex = path . indexOf ( '=' , semiIndex ) ; if ( equalsIndex < 0 ) { throw new MalformedURLException ( "Message digest parameter is missing a '='" ) ; } algorithm = path . substring ( semiIndex + 1 , equalsIndex ) ; try { MessageDigest . getInstance ( algorithm ) ; } catch ( NoSuchAlgorithmException e ) { MalformedURLException t = new MalformedURLException ( "Message digest parameter algorithm is not found: " + algorithm ) ; t . initCause ( e ) ; throw t ; } String digest = path . substring ( equalsIndex + 1 ) ; int comment = digest . indexOf ( ',' ) ; if ( comment >= 0 ) { for ( int i = digest . length ( ) ; -- i > comment ; ) { char c = digest . charAt ( i ) ; if ( ! HttpmdUtil . commentChar ( c ) ) { throw new MalformedURLException ( "Comment contains illegal character: '" + c + "'" ) ; } } digest = digest . substring ( 0 , comment ) ; } int length = digest . length ( ) ; if ( length == 0 ) { throw new MalformedURLException ( "Message digest parameter digest is empty" ) ; } try { expectedDigest = HttpmdUtil . stringDigest ( digest ) ; } catch ( NumberFormatException e ) { MalformedURLException t = new MalformedURLException ( "Message digest parameter has invalid format for digest: " + digest ) ; t . initCause ( e ) ; throw t ; } try { content = new URL ( "http" , url . getHost ( ) , url . getPort ( ) , path . substring ( 0 , semiIndex ) + ( url . getQuery ( ) == null ? "" : url . getQuery ( ) ) + ( url . getRef ( ) == null ? "" : url . getRef ( ) ) ) ; } catch ( MalformedURLException e ) { MalformedURLException t = new MalformedURLException ( "Problem with content location" ) ; t . initCause ( e ) ; throw t ; } delegateConnection = ( HttpURLConnection ) content . openConnection ( ) ; }
creates an http url connection for an httpmd url .
