Package java.net

Examples of java.net.MalformedURLException.initCause()


     * @throws MalformedURLException the created MalformedURLException
     */
    private static void throwAsMalformedURLException(final String message, final Exception cause)
                        throws MalformedURLException {
        final MalformedURLException exception = new MalformedURLException(message);
        exception.initCause(cause);
        throw exception;
    }

}
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

           
            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

            } else {
                return null;
            }
        } catch (Exception e) {
            MalformedURLException ex = new MalformedURLException("Cannot build URL");
            ex.initCause(e);
            throw ex;
        }
    }

    public InputStream getResourceAsStream(String path) {
View Full Code Here

                String uriString = uri.toString();
                url = new URL(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;
            }
        }
        return url;
    }
View Full Code Here

   */
  private static void throwAsMalformedURLException(final String message,
      final Exception cause) throws MalformedURLException {
    final MalformedURLException exception = new MalformedURLException(
        message);
    exception.initCause(cause);
    throw exception;
  }

}
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

         return new ZipEntryContext(rootURL);
      }
      catch(URISyntaxException ex)
      {
         MalformedURLException e = new MalformedURLException("Failed to convert URL to URI: " + rootURL);
         e.initCause(ex);
         throw e;
      }
   }

   /**
 
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.