Java 8 ValidationException - 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 ValidationException class.

This code example shows how to use the following methods:getMessage
		String interpolatedMessage = message;
		try { 
			interpolatedMessage = interpolateMessage( message, context, locale );
		} 
		catch ( ValidationException e ) {
			log.warn( e.getMessage() );
		} 
		return interpolatedMessage;
	} 
 
	/** 
	 * Runs the message interpolation according to algorithm specified in the Bean Validation specification. 
	 * <br/> 
	 * Note: 
	 * <br/> 
	 * Look-ups in user bundles is recursive whereas look-ups in default bundle are not! 
	 * 
	 * @param message the message to interpolate 
	 * @param context the context for this interpolation 
	 * @param locale the {@code Locale} to use for the resource bundle. 
4
CodeRank
This code example shows how to use the following methods:getMessage
 
		try { 
			req.validate();
			fail(); 
		} catch (final ValidationException e) {
			assertTrue("error should say foreignId1 has a duplicate", e.getMessage().contains("foreignId1"));
			assertTrue("error should it found 2 errors", e.getMessage().contains("foreignId1 (2 found)"));
		} 
 
		nodes.add(duplicateId);
		req.setNodes(nodes);
 
		try { 
			req.validate();
			fail(); 
		} catch (final ValidationException e) {
			assertTrue("error should say foreignId1 has a duplicate", e.getMessage().contains("foreignId1"));
			assertTrue("error count should now be 3", e.getMessage().contains("foreignId1 (3 found)"));
		} 
		 

4
CodeRank
This code example shows how to use the following methods:
        } 
 
        try { 
            return xmlValidator.validateRoot(rootObject); 
        } catch (Exception e) { 
            throw new ValidationException(e); 
        } 
    } 
 
    /** 
     * Validate a non-root object against a schema. 
     * 
     * @param object - the object to be validated 
     * @return true if a valid object, false otherwise 
     * @throws JAXBException 
     */ 
    public boolean validate(Object object) throws JAXBException { 
        if (object == null) { 
            throw new IllegalArgumentException(); 
        } 
3
CodeRank
This code example shows how to use the following methods:
     
    Stats statsObject = null;
    try { 
      statsObject = gson.fromJson(statsString, Stats.class);
    } catch (JsonParseException e) {
      throw new ValidationException("Invalid stat data " + statsString + ":" +  e.getLocalizedMessage());
    } 
   
    //Set the sample data 
    sample.setDate(dateObject);
    sample.setSummarizerSamples(statsObject.getClientRequests()); // set SamplesCount
    sample.setDuration(statsObject.getClientRequestLatencyMsAverage());
    sample.setSuccessful(true);
    sample.setSummarizerMin(statsObject.getClientRequestLatencyMsMinimum());
    sample.setSummarizerMax(statsObject.getClientRequestLatencyMsMaximum());
    sample.setSummarizerErrors((statsObject.getClientRequests() - statsObject.getClientSuccess()) + statsObject.getSumValidationErrors());
    sample.setUri(key);
     
    return sample;
  } 
3
CodeRank
See Code Examples for Java 8 ValidationException Methods: