Package java.net

Examples of java.net.MalformedURLException


   * @return a URL by concatenating feed name with header, address, port, etc.
   * @throws MalformedURLException
   */
  private URL getFeedUrl(String feedName) throws MalformedURLException {
    if (feedName == null) {
      throw new MalformedURLException("feed is not specified");
    }
    return new URL(gsaUrlStr + "/" + feedName);
  }
View Full Code Here


   * @return a URL by concatenating different parts of the URI
   * @throws MalformedURLException
   */
  private URL getEntryUrl(String feedName, String entryId) throws MalformedURLException {
    if (feedName == null || entryId == null) {
      throw new MalformedURLException("feed/entry is not specified");
    }
    return new URL(gsaUrlStr + "/" + feedName + "/" + CharEscapers.uriEscaper().escape(entryId));
  }
View Full Code Here

   * @throws MalformedURLException
   */
  private URL getEntryUrl(String feedName, String entryId, Map<String, String> queries)
                          throws MalformedURLException {
    if (feedName == null || entryId == null) {
      throw new MalformedURLException("feed/entry is not specified");
    }
    StringBuilder queryStr = new StringBuilder();
    for (Entry<String, String> q : queries.entrySet()) {
      queryStr.append(queryStr.length() != 0 ? '&' : '?');
      queryStr.append(CharEscapers.uriEscaper().escape(q.getKey()));
View Full Code Here

            if (fromEndpointReferenceType && getTarget().getAddress().getValue() != null) {
                defaultEndpointURL = new URL(this.getTarget().getAddress().getValue());
                return defaultEndpointURL;
            }
            if (endpointInfo.getAddress() == null) {
                throw new MalformedURLException("Invalid address. Endpoint address cannot be null.");
            }
            defaultEndpointURL = new URL(endpointInfo.getAddress());
        }
        return defaultEndpointURL;
    }
View Full Code Here

                         Logger           logger)
    throws IOException, ProcessingException {

        Environment env = CocoonComponentManager.getCurrentEnvironment();
        if ( env == null ) {
            throw new MalformedURLException("The cocoon protocol can not be used outside an environment.");
        }

        this.manager = manager;
        this.enableLogging(logger);
        boolean rawMode = false;
View Full Code Here

        int end;

        // Datasource
        end = url.indexOf('/', start);
        if (end == -1) {
            throw new MalformedURLException("Malformed blob source (cannot find datasource) : " + url);
        }

        this.datasourceName = url.substring(start, end);

        // Table
        start = end + 1;
        end = url.indexOf('/', start);
        if (end == -1) {
            throw new MalformedURLException("Malformed blob source (cannot find table name) : " + url);
        }

        this.tableName = url.substring(start, end);

        // Column
        start = end + 1;
        end = url.indexOf('[', start);
        if (end == -1) {
            this.columnName = url.substring(start);
        } else {
            this.columnName = url.substring(start, end);

            // Condition
            start = end + 1;
            end = url.length() - 1;
            if (url.charAt(end) != ']') {
                throw new MalformedURLException("Malformed url for a blob source (cannot find condition) : " + url);
            } else {
                this.condition = url.substring(start, end);
            }
        }
    }
View Full Code Here

    throws MalformedURLException, IOException {
        int start = location.indexOf(':') + 1;
        int end = location.indexOf(':', start);

        if (start == -1 || end == -1) {
            throw new MalformedURLException("Mispelled XML:DB URL. " +
                                            "The syntax is \"xmldb:databasetype://host/collection/resource\"");
        }

        String type = location.substring(start, end);
View Full Code Here

    private static void initConfig() throws IOException {
        try {
            String configFile = System.getProperty(PROPS_NAME);
            if (configFile == null) {
                String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + PROPS_NAME + " is not set, cannot resolve location.";
                throw new MalformedURLException(errMsg);
            }
            BasicConfigurator.configure();
            InputStream in = new FileInputStream(configFile);
            props.load(in);
            in.close();
View Full Code Here

    private static void initConfig(URL url) throws IOException {
        try {
            if (url == null) {
                String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + url.toString() + " is not set, cannot resolve location.";
                throw new MalformedURLException(errMsg);
            }
            props = UtilProperties.getProperties(url);
        } catch (IOException e) {
            e.printStackTrace();
            throw e;
View Full Code Here

            URL testProp = UtilURL.fromResource("seleniumXml.properties");
            if (testProps == null) {
                testProps = new Properties();
                if (testProp == null) {
                    String errMsg = "Cannot resolve location from test.properties.";
                    throw new MalformedURLException(errMsg);
                }
            }
            internetAccess = UtilProperties.getPropertyAsBoolean("seleniumXml", "internet.access", true);
            File file = new File(libPath);
            if (internetAccess) {
                URL url = new URL(urlSite);
                URLConnection connection = url.openConnection();
                contentLength = connection.getContentLength();
                if (contentLength == -1) {
                    request.setAttribute("_ERROR_MESSAGE_", "can not conect to the internet");
                }
                Debug.logInfo("file size. "+contentLength,module);
                if (file.exists()) {
                    if (contentLength == file.length()) {
                        lib = true;
                    } else lib = false;
                    msgMap.put("LIBFLAG",lib);
                }
            } else {
                if (file.exists()) {
                    msgMap.put("LIBFLAG",true);
                } else {
                    msgMap.put("LIBFLAG", "noInternet");
                }
            }

            /* Check a change use HTTP as the default */
            String httpStatus = null;
            URL urlProp = UtilURL.fromResource("url.properties");
            if (urlProps == null) {
                urlProps = new Properties();
                if (urlProp == null) {
                    String errMsg = "Cannot resolve location from url.properties.";
                    throw new MalformedURLException(errMsg);
                }
                urlProps = UtilProperties.getProperties(urlProp);
                if (urlProps != null) {
                    httpStatus = urlProps.getProperty("port.https.enabled");
                    if (httpStatus != null && httpStatus.equals("N")) {
View Full Code Here

TOP

Related Classes of java.net.MalformedURLException

Copyright © 2018 www.massapicom. 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.