Package java.net

Examples of java.net.MalformedURLException


    }

    public GeoTIFFFile(URL fileURL) throws MalformedURLException, IOException,
            IllegalArgumentException {
        if (fileURL == null) {
            throw new MalformedURLException("Null file provided as URL");
        }
        init(fileURL);
    }
View Full Code Here


       oObjStrm = new ObjectInputStream(oBteStrm);
     oRetVal = oObjStrm.readObject();
     oObjStrm.close();
     oBteStrm.close();
    } else {
      throw new MalformedURLException("FileSystem.readfileobj("+sFilePath+") File protocol must begin with file:// or ftp://");
    }
    return oRetVal;
  } // readfileobj
View Full Code Here

    // Getting resources via the classloader
    public URL getResource(String path) throws MalformedURLException {
        if (path == null) {
            return null;
        } else if (!path.startsWith("/")) {
            throw new MalformedURLException(Launcher.RESOURCES.getString(
                    "WebAppConfig.BadResourcePath", path));
        } else if (!path.equals("/") && path.endsWith("/")) {
            path = path.substring(0, path.length() - 1);
        }
        File res = new File(webRoot, path.substring(1));
View Full Code Here

  } catch (URISyntaxException ex) {
      /* With RFC 3986 URI handling, 'rmi://:<port>' and
       * '//:<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

    private static ParsedNamingURL intParseURL(String str)
  throws MalformedURLException, URISyntaxException
    {
  URI uri = new URI(str);
  if (uri.isOpaque()) {
      throw new MalformedURLException(
    "not a hierarchical URL: " + str);
  }
  if (uri.getFragment() != null) {
      throw new MalformedURLException(
    "invalid character, '#', in URL name: " + str);
  } else if (uri.getQuery() != null) {
      throw new MalformedURLException(
    "invalid character, '?', in URL name: " + str);
  } else if (uri.getUserInfo() != null) {
      throw new MalformedURLException(
    "invalid character, '@', in URL host: " + str);
  }
  String scheme = uri.getScheme();
  if (scheme != null && !scheme.equals("rmi")) {
      throw new MalformedURLException("invalid URL scheme: " + str);
  }

  String name = uri.getPath();
  if (name != null) {
      if (name.startsWith("/")) {
    name = name.substring(1);
      }
      if (name.length() == 0) {
    name = null;
      }
  }

  String host = uri.getHost();
  if (host == null) {
      host = "";
      try {
    /*
     * With 2396 URI handling, forms such as 'rmi://host:bar'
     * or 'rmi://:<port>' are parsed into a registry based
     * authority. We only want to allow server based naming
     * authorities.
     */
    uri.parseServerAuthority();
      } catch (URISyntaxException use) {
    // Check if the authority is of form ':<port>'
    String authority = uri.getAuthority();
    if (authority != null && authority.startsWith(":")) {
        // Convert the authority to 'localhost:<port>' form
        authority = "localhost" + authority;
        try {
      uri = new URI(null, authority, null, null, null);
      // Make sure it now parses to a valid server based
      // naming authority
      uri.parseServerAuthority();
        } catch (URISyntaxException use2) {
      throw new
          MalformedURLException("invalid authority: " + str);
        }
    } else {
        throw new
      MalformedURLException("invalid authority: " + str);
    }
      }
  }
  int port = uri.getPort();
View Full Code Here

        int start = URL_PREFIX_LEN;

        // Datasource
        int 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

        currentMimeType = DEFAULT_MIME_TYPES.get(extension);
      }
      if (mimeType == null) {
        mimeType = currentMimeType;
      } else if (!mimeType.equals(currentMimeType)) {
        throw new MalformedURLException("Combined resource path: " + rawResourcePath
            + " is invalid. All resources in a combined resource path must be of the same mime type.");
      }
      contentLength += resourceConn.getContentLength();
      try {
        resourceConn.getInputStream().close();
View Full Code Here

        currentMimeType = DEFAULT_MIME_TYPES.get(extension);
      }
      if (mimeType == null) {
        mimeType = currentMimeType;
      } else if (!mimeType.equals(currentMimeType)) {
        throw new MalformedURLException("Combined resource path: " + rawResourcePath
            + " is invalid. All resources in a combined resource path must be of the same mime type.");
      }
      contentLength += resourceConn.getContentLength();
      try {
        resourceConn.getInputStream().close();
View Full Code Here

      // Fail if no valid key store was located
      if (url == null)
      {
         String msg = "Failed to find url=" + storeURL + " as a URL, file or resource";
         throw new MalformedURLException(msg);
      }
      return url;
   }
View Full Code Here

    RemoteAspectManager[] rams;
    try {
      intPort = Integer.parseInt(port);
    }
    catch (NumberFormatException thisIsNotAPortNum) {
      throw new MalformedURLException("Illegal port number");
    }
    try {
      rams = RemoteProseComponent.doGetRemoteAspectManagers(host,intPort);
      if (isReal)
        exMngr= rams[0];
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.