Package java.net

Examples of java.net.MalformedURLException.initCause()


       * '//:<port>' forms will result in a URI syntax exception
       * Convert the authority to a localhost:<port> form
       */
      MalformedURLException mue = new MalformedURLException(
    "invalid URL String: " + str);
      mue.initCause(ex);
      int indexSchemeEnd = str.indexOf(':');
      int indexAuthorityBegin = str.indexOf("//:");
      if (indexAuthorityBegin < 0) {
    throw mue;
      }
View Full Code Here


            return ESCAPE_PATTERN.matcher(uriString).replaceAll("%$1");
        } catch (URISyntaxException e) {
            IOException ioe = new MalformedURLException("Couldn't convert '" + url.toString()
                    + "' to a valid URI");
            ioe.initCause(e);
            throw ioe;
        }
    }

    protected URL normalizeToURL(URL url) throws IOException {
View Full Code Here

  try {
      uri = new URI(url);
  } catch (URISyntaxException e) {
      MalformedURLException mue =
    new MalformedURLException("URI parsing failure: " + url);
      mue.initCause(e);
      throw mue;
  }
  if (!uri.isAbsolute()) {
      throw new MalformedURLException("no scheme specified: " + url);
  }
View Full Code Here

      try {
    portInt = Integer.parseInt(portString);
      } catch (NumberFormatException ne) {
    MalformedURLException mue = new MalformedURLException(
        "invalid port in authority: " + uri);
    mue.initCause(ne);
    throw mue;
      }
  }
  port = portInt;
  host = authority.substring(0, index);
View Full Code Here

      request.setHeader(HttpHeaders.Names.HOST, host);
      String uri = url.substring(url.indexOf(host) + host.length());
      request.setUri(uri);
    } catch (Exception x) {
      MalformedURLException m = new MalformedURLException("Unable to parse: " + url);
      m.initCause(x);
      throw m;
    }
    return this;
  }
 
View Full Code Here

             * Occurs only if the URL is not compliant with RFC 2396. Otherwise every URL
             * should succeed, so a failure can actually be considered as a malformed URL.
             */
            final MalformedURLException e = new MalformedURLException(Exceptions.formatChainedMessages(
                    null, Errors.format(Errors.Keys.IllegalArgumentValue_2, "URL", path), cause));
            e.initCause(cause);
            throw e;
        }
    }

    /**
 
View Full Code Here

             * in a File (e.g. a Query part), so it could be considered as if the URI with
             * the fragment part can not represent an existing file.
             */
            final MalformedURLException e = new MalformedURLException(Exceptions.formatChainedMessages(
                    null, Errors.format(Errors.Keys.IllegalArgumentValue_2, "URL", url), cause));
            e.initCause(cause);
            throw e;
        }
    }

    /**
 
View Full Code Here

                    if ("rmi".equals(pro) &&
                        path.startsWith("/jndi/iiop:")) {
                        MalformedURLException mfe = new MalformedURLException(
                              "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL);
                        mfe.initCause(re);
                        throw mfe;
                    }
                }
                throw re;
            }
View Full Code Here

             * '//:<port>' forms will result in a URI syntax exception
             * Convert the authority to a localhost:<port> form
             */
            MalformedURLException mue = new MalformedURLException(
                "invalid URL String: " + str);
            mue.initCause(ex);
            int indexSchemeEnd = str.indexOf(':');
            int indexAuthorityBegin = str.indexOf("//:");
            if (indexAuthorityBegin < 0) {
                throw mue;
            }
View Full Code Here

    if ("rmi".equals(pro) &&
        path.startsWith("/jndi/iiop:")) {
        MalformedURLException mfe = new MalformedURLException(
        "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL);
        mfe.initCause(re);
        throw mfe;
    }
    throw re;
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.