code: private String fixupDomainlabel(String label)
      throws URIException {
          
          // apply IDN-punycoding, as necessary
          try {
              // TODO: optimize: only apply when necessary, or
              // keep cache of recent encodings
              label = IDNA.toASCII(label);
          } catch (IDNAException e) {
              if(TextUtils.matches(ACCEPTABLE_ASCII_DOMAIN,label)) {
                  // domain name has ACE prefix, leading/trailing dash, or 
                  // underscore -- but is still a name we wish to tolerate;
                  // simply continue
              } else {
                  // problematic domain: neither ASCII acceptable characters
                  // nor IDN-punycodable, so throw exception 
                  // TODO: change to HeritrixURIException so distinguishable
                  // from URIExceptions in library code
                  URIException ue = new URIException(e+" "+label);
                  ue.initCause(e);
                  throw ue;
              }
          }
          label = label.toLowerCase();
          return label;
      }
docs: Fixup the domain label part of the authority.
  
  We're more lax than the spec. in that we allow underscores.
  
  @param label Domain label to fix.
  @return Return fixed domain label.
  @throws URIException