Package java.text

Examples of java.text.ParseException.initCause()


      else {
          message = " unexpected token " + getReadableTokenString(re.token)
                  " at position (" + re.charPositionInLine + ").";
      }
      ParseException parseException = new ParseException(message, re.charPositionInLine);
      parseException.initCause(re);
      throw new RuntimeException(parseException);
  }

  public static String getReadableTokenString(Token token) {
      if (token == null) {
View Full Code Here


  @Override
  public void displayRecognitionError(String[] tokenNames, RecognitionException re) { 
      String message = " unexpected character '" + (char)re.c
                     + "' at position (" + re.charPositionInLine + ").";
      ParseException parseException = new ParseException(message, re.charPositionInLine);
      parseException.initCause(re);
      throw new RuntimeException(parseException);
  }


View Full Code Here

        source = CharSequences.trimWhitespaces(source);
        try {
            return valueOf(source);
        } catch (NumberFormatException cause) {
            ParseException e = new LocalizedParseException(null, type, source, null);
            e.initCause(cause);
            throw e;
        }
    }

    /**
 
View Full Code Here

                if (v != null) {
                    try {
                        qs = (int)(Float.valueOf(v) * 1000.0);
                    } catch (NumberFormatException ex) {
                        ParseException pe = new ParseException("The quality source (qs) value, " + v + ", is not a valid value", 0);
                        pe.initCause(ex);
                    }
                    if (qs < 0)
                        throw new ParseException("The quality source (qs) value, " + v + ", must be non-negative number", 0);
                }
            }
View Full Code Here

        q.setMeasure(measure);
        try {
            q.init();
        } catch (Exception e) {
            ParseException e2 = new ParseException(query + ": " + e.getMessage(), 0);
            e2.initCause(e);
            throw e2;
        }
        return q;
    }
   
View Full Code Here

        if (namePathMapper != null) {
            try {
                nodeTypeName = namePathMapper.getOakName(nodeTypeName);
            } catch (RepositoryException e) {
                ParseException e2 = getSyntaxError("could not convert node type name " + nodeTypeName);
                e2.initCause(e);
                throw e2;
            }
        }
        NodeState type = types.getChildNode(nodeTypeName);
        if (!type.exists()) {
View Full Code Here

                parser.setIncludeSelectorNameInWildcardColumns(false);
                return parser.parse(sql2);
            } catch (ParseException e) {
                ParseException e2 = new ParseException(
                        statement + " converted to SQL-2 " + e.getMessage(), 0);
                e2.initCause(e);
                throw e2;
            }
        } else {
            throw new ParseException("Unsupported language: " + language, 0);
        }
View Full Code Here

            failure = e;
        }
        final int errorIndex = pos.getErrorIndex();
        final ParseException e = new ParseException(Errors.format(Errors.Keys.UnparsableStringForClass_3,
                elementType, source, CharSequences.token(source, errorIndex)), errorIndex);
        e.initCause(failure);
        throw e;
    }

    /**
     * Parses text from a string to produce a range. The method attempts to parse text starting
View Full Code Here

        q.setMeasure(measure);
        try {
            q.init();
        } catch (Exception e) {
            ParseException e2 = new ParseException(query + ": " + e.getMessage(), 0);
            e2.initCause(e);
            throw e2;
        }
        return q;
    }
   
View Full Code Here

        if (namePathMapper != null) {
            try {
                nodeTypeName = namePathMapper.getOakName(nodeTypeName);
            } catch (RepositoryException e) {
                ParseException e2 = getSyntaxError("could not convert node type name " + nodeTypeName);
                e2.initCause(e);
                throw e2;
            }
        }
        NodeState type = types.getChildNode(nodeTypeName);
        if (!type.exists()) {
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.