Examples of PropertyParseException


Examples of com.thetransactioncompany.util.PropertyParseException

          try {
            allowedOrigins.add(new Origin(url).validate());

                                  } catch (OriginException e) {
         
                                          throw new PropertyParseException("Bad origin URL in property cors.allowOrigin: " + url);
                                  }
        }
      }
     
      // Parse the allow origin suffix matching option
      allowSubdomains = pr.getOptBoolean("cors.allowSubdomains", false);
     

      // Parse the supported methods list

      String methodSpec = pr.getOptString("cors.supportedMethods", "GET, POST, HEAD, OPTIONS").trim().toUpperCase();

      String[] methodNames = parseWords(methodSpec);

      supportedMethods = new HashSet<HTTPMethod>();

      for (String methodName: methodNames) {

        try {
          supportedMethods.add(HTTPMethod.valueOf(methodName));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad HTTP method name in property cors.allowMethods: " + methodName);
        }
      }
     

      // Parse the supported headers list
      String headerSpec;

      // Empty value has special meaning of "no supported headers"
      try {
        headerSpec = pr.getString("cors.supportedHeaders");

      } catch (PropertyParseException e) {

        headerSpec = "*";
      }

      if (headerSpec.equals("*")) {

        supportAnyHeader = true;
        supportedHeaders = Collections.unmodifiableSet(new HashSet<HeaderFieldName>());

      } else {

        supportAnyHeader = false;

        String[] headers = parseWords(headerSpec);

        supportedHeaders = new HashSet<HeaderFieldName>();

        for (String header: headers) {

          try {
            supportedHeaders.add(new HeaderFieldName(header));

          } catch (IllegalArgumentException e) {

            throw new PropertyParseException("Bad header field name in property cors.supportedHeaders: " + header);
          }
        }
      }


      // Parse the exposed headers list
      exposedHeaders = new HashSet<HeaderFieldName>();

      for (String header: parseWords(pr.getOptString("cors.exposedHeaders", ""))) {

        try {
          exposedHeaders.add(new HeaderFieldName(header));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad header field name in property cors.exposedHeaders: " + header);
        }
      }


      // Parse the allow credentials option
View Full Code Here

Examples of com.thetransactioncompany.util.PropertyParseException

          try {
            allowedOrigins.add(new Origin(url).validate());

                                  } catch (OriginException e) {
         
                                          throw new PropertyParseException("Bad origin URL in property cors.allowOrigin: " + url);
                                  }
        }
      }
     
      // Parse the allow origin suffix matching option
      allowSubdomains = pr.getOptBoolean("cors.allowSubdomains", false);
     

      // Parse the supported methods list

      String methodSpec = pr.getOptString("cors.supportedMethods", "GET, POST, HEAD, OPTIONS").trim().toUpperCase();

      supportedMethods = new HashSet<String>();

      for (String methodName: parseWords(methodSpec)) {

        supportedMethods.add(methodName);
      }
     

      // Parse the supported headers list
      String headerSpec;

      // Empty value has special meaning of "no supported headers"
      try {
        headerSpec = pr.getString("cors.supportedHeaders");

      } catch (PropertyParseException e) {

        headerSpec = "*";
      }

      if (headerSpec.equals("*")) {

        supportAnyHeader = true;
        supportedHeaders = Collections.unmodifiableSet(new HashSet<String>());

      } else {

        supportAnyHeader = false;

        String[] headers = parseWords(headerSpec);

        supportedHeaders = new HashSet<String>();

        for (String header: headers) {

          try {
            supportedHeaders.add(HeaderName.formatCanonical(header));

          } catch (IllegalArgumentException e) {

            throw new PropertyParseException("Bad header field name in property cors.supportedHeaders: " + header);
          }
        }
      }


      // Parse the exposed headers list
      exposedHeaders = new HashSet<String>();

      for (String header: parseWords(pr.getOptString("cors.exposedHeaders", ""))) {

        try {
          exposedHeaders.add(HeaderName.formatCanonical(header));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad header field name in property cors.exposedHeaders: " + header);
        }
      }


      // Parse the allow credentials option
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

        {
          rgb = Integer.parseInt(value.substring(1), 16);
        }
        catch (NumberFormatException e)
        {
          throw new PropertyParseException(_INVALID_COLOR + value);
        }

        return _getSharedColor(rgb);
      }
      else if (length == 4)
      {
        // #RGB
        int r = 0;
        int g = 0;
        int b = 0;

        try
        {
          r = Integer.parseInt(value.substring(1, 2), 16);
          g = Integer.parseInt(value.substring(2, 3), 16);
          b = Integer.parseInt(value.substring(3, 4), 16);
        }
        catch (NumberFormatException e)
        {
          throw new PropertyParseException(_INVALID_COLOR + value);
        }

        int rgb = (((r << 20) & 0xf00000) |
                   ((r << 16) & 0x0f0000) |
                   ((g << 12) & 0x00f000) |
                   ((g << 8& 0x000f00) |
                   ((b << 4& 0x0000f0) |
                    (b & 0x00000f));

        return _getSharedColor(rgb);
      }
      else
      {
        throw new PropertyParseException(_INVALID_COLOR + value);
      }
    }

    // Handle rgb(r, g, b) values
    if (value.startsWith("rgb"))
    {
      int startIndex = value.indexOf('\u0028')// Start paren
      int endIndex = value.indexOf('\u0029');    // End paren
      if ((startIndex == -1) || (endIndex == -1) || (endIndex <= startIndex))
      {
        throw new PropertyParseException(_INVALID_COLOR + value);
      }

      // Tokenize on whitespace or commas
      StringTokenizer tokens = new StringTokenizer(
                                 value.substring(startIndex + 1, endIndex),
                                 " \t,");

      String redToken = null;
      String blueToken = null;
      String greenToken = null;

      try
      {
        redToken = tokens.nextToken();
        greenToken = tokens.nextToken();
        blueToken = tokens.nextToken();
      }
      catch (NoSuchElementException e)
      {
        throw new PropertyParseException(_INVALID_COLOR + value);
      }

      int red = _parseColorComponent(value, redToken);
      int green = _parseColorComponent(value, greenToken);
      int blue = _parseColorComponent(value, blueToken);

      return _getSharedColor(red, green, blue);
    }

    // Check for system color values.  We can't actually return valid
    // values for these, but we also don't want to throw a
    // PropertyParseException if a system color is specified.
    if (ArrayMap.get(_SYSTEM_COLORS, value) != null)
      return null;

    throw new PropertyParseException(_INVALID_COLOR + value);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

      return parseLength(value);

    if (_isPercentage(value))
      return _parsePercentage(value);

    throw new PropertyParseException(_INVALID_FONT_SIZE + value);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

      return CoreStyle.PLAIN_FONT_STYLE;

    if (_ITALIC_STYLE.equals(value) || _OBLIQUE_STYLE.equals(value))
      return CoreStyle.ITALIC_FONT_STYLE;

    throw new PropertyParseException(_INVALID_FONT_STYLE + value);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

    catch (NumberFormatException e)
    {
      ;
    }

    throw new PropertyParseException(_INVALID_FONT_WEIGHT + value);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

    value = _stripWhitespace(value);

    if (_isLength(value))
      return _parseLength(value);

    throw new PropertyParseException(_INVALID_LENGTH + value);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

      {
        percent = Double.parseDouble(comp.substring(0, comp.length() - 1));
      }
      catch (NumberFormatException e)
      {
        throw new PropertyParseException(_INVALID_COLOR + value);
      }

      col = (int)((percent/100.0) * 255);
    }
    else
    {
      try
      {
        col = Integer.parseInt(comp);
      }
      catch (NumberFormatException e)
      {
        throw new PropertyParseException(_INVALID_COLOR + value);
      }
    }

    if (col < 0)
      return 0;
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

    {
      size = Double.parseDouble(value.substring(0, value.length() - 2));
    }
    catch (NumberFormatException e)
    {
      throw new PropertyParseException(_INVALID_LENGTH + value);
    }

    // Convert the size to "points".  This conversion isn't really valid,
    // since we don't check the screen resolution.  We just convert using
    // the assuming that 1pt = 1px, which of course isn't really the
    // case, but what are we going to do?
    int points = 0;

    if (value.endsWith("in"))
    {
      points = (int)(72 * size);
    }
    else if (value.endsWith("cm"))
    {
      points = (int)((72 * size)/2.54);
    }
    else if (value.endsWith("mm"))
    {
      points = (int)((72 * size)/25.4);
    }
    else if (value.endsWith("pt"))
    {
      points = (int)size;
    }
    else if (value.endsWith("pc"))
    {
      points = (int)(12 * size);
    }
    else if (value.endsWith("em"))
    {
      // We don't even try to figure out the right em size.  If you don't
      // like it, don't use em units for your image styles.
      points = (int)(12 * size);
    }
    else if (value.endsWith("ex"))
    {
      // We don't even try to figure out the right ex size.  If you don't
      // like it, don't use ex units for your image styles.
      points = (int)(6 * size);

    }
    else if (value.endsWith("px"))
    {
      points = (int)size;
    }
    else
    {
      throw new PropertyParseException(_INVALID_LENGTH + value);
    }

    return points;
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.style.PropertyParseException

    {
      percent = Double.parseDouble(value.substring(0, value.length() - 1));
    }
    catch (NumberFormatException e)
    {
      throw new PropertyParseException(_INVALID_PERCENTAGE + value);
    }

    // We just assume the percentage is relative to our base font size - 12pt.
    return (int)((percent/100.0) * 12);
  }
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.