Java 8 ParseException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ParseException class.

This code example shows how to use the following methods:
    } 
 
    @Test(expected = ParseException.class) 
    public void should_notify_all_listeners_when_called_delegate_handler_throws_exception_and_rethrow_it() throws Throwable { 
        // given 
        ParseException parseException = new ParseException("", 0); 
        given(mockHandler.handle(invocation)).willThrow(parseException); 
 
        // when 
        try { 
            notifier.handle(invocation); 
            fail(); 
        } finally { 
            // then 
            verify(listener1).reportInvocation(new NotifiedMethodInvocationReport(invocation, parseException)); 
            verify(listener2).reportInvocation(new NotifiedMethodInvocationReport(invocation, parseException)); 
        } 
    } 
 
    @Test 
    public void should_report_listener_exception() throws Throwable { 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            iso8601String = iso8601String.replace("Z", "+00:00"); //$NON-NLS-1$ //$NON-NLS-2$
            try { 
                iso8601String = iso8601String.substring(0, 22) + iso8601String.substring(23);
            } catch (IndexOutOfBoundsException e) {
                e.printStackTrace();
                throw new ParseException("Invalid ISO 8601 length for string " + iso8601String, 0); //$NON-NLS-1$
            } 
            formatString = "yyyy-MM-dd'T'HH:mm:ssZ"; //$NON-NLS-1$
        } else { 
            formatString = "yyyy-MM-dd"; //$NON-NLS-1$
        } 
 
        Date result = new SimpleDateFormat(formatString).parse(iso8601String);
        return result.getTime();
    } 
 
    public static String timeToIso8601(long time, boolean includeTime) {
        if (time == 0)
            return null; 
        Date date = new Date(time);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
 
			Date date = iso8601.toDate(value);
 
			return date;
		} catch (ParseException e) {
			throw new ConversionError("Error to convert Date: "	+ e.getMessage());
		} 
	} 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
 
			Calendar calendar = iso8601.toCalendar(value);
 
			return calendar;
		} catch (ParseException e) {
			throw new ConversionError("Error to convert Calendar: "	+ e.getMessage());
		} 
	} 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    return cursor;
  } 
 
  public OJSONReader checkContent(final String iExpected) throws ParseException {
    if (!value.equals(iExpected))
      throw new ParseException("Expected content is " + iExpected + " but found " + value, cursor);
    return this;
  } 
 
  public boolean isContent(final String iExpected) {
    return value.equals(iExpected);
  } 
 
  public int readInteger(final char[] iUntil) throws IOException, ParseException {
    return readNumber(iUntil, false);
  } 
 
  public int readNumber(final char[] iUntil, final boolean iInclude) throws IOException, ParseException {
    if (readNext(iUntil, iInclude) == null)
      throw new ParseException("Expected integer", cursor);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toString
                SimpleDateFormat sdf = new SimpleDateFormat(I18N.getDateFormat());
                sdf.setLenient(false);
                cal.setTime(sdf.parse(value));
            } 
        } catch (ParseException e) {
            throw new IllegalArgumentException("Cannot convert [" + value + "] to a Calendar: " + e.toString());
        } 
 
        return cal;
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		String nextStr = logicalPartition.substring(1);
		String[] parts = nextStr.split("_");
		 
		if (parts.length != 2)
		{ 
			throw new ParseException("logical Partition does not have numbers of format p[num1]_[num2]" + logicalPartition, 0);
		} 
		int p = Integer.parseInt(parts[0]);
		int s = Integer.parseInt(parts[1]); 
		 
		_logicalPartition = logicalPartition;
		_partitionNum = p;
		_schemaVersion = s;			
	} 
	 
	LogicalPartitionRepresentation(int partitionNum, int schemaVersion)
	{ 
		_partitionNum = partitionNum;
		_schemaVersion = schemaVersion;
		_logicalPartition = "p" + Integer.toString(partitionNum) + "_" + Integer.toString(schemaVersion);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
		else { 
			try { 
				setValue(this.dateFormat.parse(text));
			} 
			catch (ParseException ex) {
				throw new IllegalArgumentException("Could not parse date: " + ex.getMessage(), ex);
			} 
		} 
	} 
 
	/** 
	 * Format the Date as String, using the specified DateFormat. 
	 */ 
	@Override 
	public String getAsText() {
		Date value = (Date) getValue();
		return (value != null ? this.dateFormat.format(value) : "");
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:initCause
    } 
 
    try { 
      return new Version(major, minor, bugfix, prerelease);
    } catch (IllegalArgumentException iae) {
      ParseException pe = new ParseException("failed to parse version string \"" + version + "\": " + iae.getMessage(), 0);
      pe.initCause(iae);
      throw pe;
    } 
  } 
 
  /** 
   * Parse the given version number as a constant or dot based version. 
   * <p>This method allows to use {@code "LUCENE_X_Y"} constant names, 
   * or version numbers in the format {@code "x.y.z"}. 
   * 
   * @lucene.internal 
   */ 
  public static Version parseLeniently(String version) throws ParseException {
    String versionOrig = version;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
  @Override 
  protected Shape parseShape(String str) {
    try { 
      return tree.parseShape(str);
    } catch (ParseException e) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
          "Couldn't parse date because: "+ e.getMessage(), e);
    } 
  } 
 
  @Override 
  protected String shapeToString(Shape shape) {
    return shape.toString();//generally round-trips for DateRangePrefixTree
  } 
 
  @Override 
  protected SpatialArgs parseSpatialArgs(QParser parser, String externalVal) {
    //We avoid SpatialArgsParser entirely because it isn't very Solr-friendly 
    final Shape shape = parseShape(externalVal);
    final SolrParams localParams = parser.getLocalParams();
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 ParseException Questions & Answers:

See Code Examples for Java 8 ParseException Methods: