Package java.net

Examples of java.net.URISyntaxException


        final String processed = catalogTableUri.replaceAll(DOLLAR_EXPR_START_REGEX, DOLLAR_EXPR_START_NORMALIZED)
                                                .replaceAll("}", EXPR_CLOSE_NORMALIZED);
        URI tableUri = new URI(processed);

        if (!"catalog".equals(tableUri.getScheme())) {
            throw new URISyntaxException(tableUri.toString(), "catalog scheme is missing");
        }

        final String schemeSpecificPart = tableUri.getSchemeSpecificPart();
        if (schemeSpecificPart == null) {
            throw new URISyntaxException(tableUri.toString(), "Database and Table are missing");
        }

        String[] paths = schemeSpecificPart.split(INPUT_PATH_SEPARATOR);

        if (paths.length != 2) {
            throw new URISyntaxException(tableUri.toString(), "URI path is not in expected format: database:table");
        }

        database = paths[0];
        table = paths[1];

        if (database == null || database.length() == 0) {
            throw new URISyntaxException(tableUri.toString(), "DB name is missing");
        }
        if (table == null || table.length() == 0) {
            throw new URISyntaxException(tableUri.toString(), "Table name is missing");
        }

        String partRaw = tableUri.getFragment();
        if (partRaw == null || partRaw.length() == 0) {
            throw new URISyntaxException(tableUri.toString(), "Partition details are missing");
        }

        final String rawPartition = partRaw.replaceAll(DOLLAR_EXPR_START_NORMALIZED, DOLLAR_EXPR_START_REGEX)
                                           .replaceAll(EXPR_CLOSE_NORMALIZED, EXPR_CLOSE_REGEX);
        partitions = new LinkedHashMap<String, String>(); // preserve insertion order
        String[] parts = rawPartition.split(PARTITION_SEPARATOR);
        for (String part : parts) {
            if (part == null || part.length() == 0) {
                continue;
            }

            String[] keyVal = part.split(PARTITION_KEYVAL_SEPARATOR);
            if (keyVal.length != 2) {
                throw new URISyntaxException(tableUri.toString(),
                        "Partition key value pair is not specified properly in (" + part + ")");
            }

            partitions.put(keyVal[0], keyVal[1]);
        }
View Full Code Here


    private void parseUriTemplate(URI uriTemplate) throws URISyntaxException {
        String path = uriTemplate.getPath();
        String[] paths = path.split(OUTPUT_PATH_SEPARATOR);
        if (paths.length != 4) {
            throw new URISyntaxException(uriTemplate.toString(),
                    "URI path is not in expected format: database:table");
        }

        database = paths[1];
        table = paths[2];
        String partRaw = paths[3];

        if (database == null || database.length() == 0) {
            throw new URISyntaxException(uriTemplate.toString(), "DB name is missing");
        }
        if (table == null || table.length() == 0) {
            throw new URISyntaxException(uriTemplate.toString(), "Table name is missing");
        }
        if (partRaw == null || partRaw.length() == 0) {
            throw new URISyntaxException(uriTemplate.toString(), "Partition details are missing");
        }

        String rawPartition = partRaw.replaceAll(DOLLAR_EXPR_START_NORMALIZED, DOLLAR_EXPR_START_REGEX)
                .replaceAll(EXPR_CLOSE_NORMALIZED, EXPR_CLOSE_REGEX);
        partitions = new LinkedHashMap<String, String>();
        String[] parts = rawPartition.split(PARTITION_SEPARATOR);
        for (String part : parts) {
            if (part == null || part.length() == 0) {
                continue;
            }

            String[] keyVal = part.split(PARTITION_KEYVAL_SEPARATOR);
            if (keyVal.length != 2) {
                throw new URISyntaxException(uriTemplate.toString(),
                        "Partition key value pair is not specified properly in (" + part + ")");
            }

            partitions.put(keyVal[0], keyVal[1]);
        }
View Full Code Here

                    }
                }
            }
            return rc;
        }catch(UnsupportedEncodingException e){
            throw (URISyntaxException) new URISyntaxException(e.toString(),"Invalid encoding").initCause(e);
        }
    }
View Full Code Here

    private static void parseComposite(URI uri, CompositeData rc, String ssp) throws URISyntaxException {
        String componentString;
        String params;

        if(!checkParenthesis(ssp)){
            throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis");
        }

        int p;
        int intialParen = ssp.indexOf("(");
        if( intialParen==0 ) {
View Full Code Here

                return rc.toString();
            } else {
                return "";
            }
        } catch (UnsupportedEncodingException e) {
            throw (URISyntaxException)new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
        }
    }
View Full Code Here

    if(this.getOrigin() == null) return 0;

    //
    // Check valid URI
    //
    if(uri.getScheme() == null) throw new URISyntaxException(uri.toString(), "no valid scheme");
    if(uri.getAuthority() == null) throw new URISyntaxException(uri.toString(), "no valid authority");

    //
    // Wildcard match
    //
    if (getOrigin().equals("*")){
 
View Full Code Here

         if (entryURL == null)
            entryURL = new URL(jarURL, getName());
      }
      catch (MalformedURLException e)
      {
         throw new URISyntaxException("Failed to create relative jarURL", e.getMessage());
      }
      return entryURL.toURI();
   }
View Full Code Here

   * @param s
   * @throws URISyntaxException
   */
  public URIish(String s) throws URISyntaxException {
    if (StringUtils.isEmptyOrNull(s)) {
      throw new URISyntaxException("The uri was empty or null",
          JGitText.get().cannotParseGitURIish);
    }
    Matcher matcher = SINGLE_SLASH_FILE_URI.matcher(s);
    if (matcher.matches()) {
      scheme = matcher.group(1);
      path = cleanLeadingSlashes(matcher.group(2), scheme);
    } else {
      matcher = FULL_URI.matcher(s);
      if (matcher.matches()) {
        scheme = matcher.group(1);
        user = matcher.group(2);
        pass = matcher.group(3);
        host = matcher.group(4);
        if (matcher.group(5) != null)
          port = Integer.parseInt(matcher.group(5));
        path = cleanLeadingSlashes(
            n2e(matcher.group(6)) + n2e(matcher.group(7)),
            scheme);
      } else {
        matcher = RELATIVE_SCP_URI.matcher(s);
        if (matcher.matches()) {
          user = matcher.group(1);
          pass = matcher.group(2);
          host = matcher.group(3);
          path = matcher.group(4);
        } else {
          matcher = ABSOLUTE_SCP_URI.matcher(s);
          if (matcher.matches()) {
            user = matcher.group(1);
            pass = matcher.group(2);
            host = matcher.group(3);
            path = matcher.group(4);
          } else {
            matcher = LOCAL_FILE.matcher(s);
            if (matcher.matches()) {
              path = matcher.group(1);
            } else
              throw new URISyntaxException(s,
                  JGitText.get().cannotParseGitURIish);
          }
        }
      }
    }
View Full Code Here

  @Override
  public boolean isValidURI(String uriString) {
      try {
        java.net.URI u = new java.net.URI(uriString);
        if (!u.isAbsolute()) {
          throw new URISyntaxException(uriString, "URI is not absolute");
        }
          return true;
      } catch (URISyntaxException e) {
          log.debug("Only well-formed absolute URIrefs can be included in RDF/XML output: <"
                    + uriString + "> " + e.getMessage());
View Full Code Here

                    }
                }
            }
            return rc;
        } catch (UnsupportedEncodingException e) {
            URISyntaxException se = new URISyntaxException(e.toString(), "Invalid encoding");
            se.initCause(e);
            throw se;
        }
    }
View Full Code Here

TOP

Related Classes of java.net.URISyntaxException

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.