Spring Framework NoSuchMessageException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework NoSuchMessageException class.

This code example shows how to use the following methods:getMessage
	/** 
	 * Return exception message that indicates the current theme. 
	 */ 
	@Override 
	protected String getNoSuchMessageExceptionDescription(NoSuchMessageException ex) { 
		return "Theme '" + getRequestContext().getTheme().getName() + "': " + ex.getMessage(); 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
	public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
		if (this.parentMessageSource != null) {
			return this.parentMessageSource.getMessage(code, args, locale);
		} 
		else { 
			throw new NoSuchMessageException(code, locale);
		} 
	} 
 
	@Override 
	public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
		if (this.parentMessageSource != null) {
			return this.parentMessageSource.getMessage(resolvable, locale);
		} 
		else { 
			if (resolvable.getDefaultMessage() != null) {
				return renderDefaultMessage(resolvable.getDefaultMessage(), resolvable.getArguments(), locale);
			} 
			String[] codes = resolvable.getCodes();
			String code = (codes != null && codes.length > 0 ? codes[0] : null);
6
CodeRank
This code example shows how to use the following methods:getMessage
 
	/** 
	 * Return default exception message. 
	 */ 
	protected String getNoSuchMessageExceptionDescription(NoSuchMessageException ex) { 
		return ex.getMessage(); 
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:
		if (message == null && object != null) {
			throw new NoSuchObjectMessageException(object, locale);
		} 
		return message;
	} 
 
	/** 
	 * Returns a fully resolved message, includes resolving any message parameters. 
	 * @param object the object to resolve. Can be <tt>null</tt> 
	 * @param args the message arguments 
	 * @param locale the locale 
	 * @param allowResolveToString if the {@link #resolveToString(Object)} can be used to create the result 
	 * @return a fully resolved message 
	 */ 
	private String getFullyResolvedMessage(Object object, Object[] args, Locale locale, boolean allowResolveToString) {
		if (object == null) {
			return null; 
		} 
		try { 
			String resolvedMessage = resolveMessage(object, args, locale);
4
CodeRank
This code example shows how to use the following methods:getMessage
	 
	/** 
	 * Return default exception message. 
	 */ 
	protected String getNoSuchMessageExceptionDescription(NoSuchMessageException ex) { 
		return ex.getMessage(); 
	} 
	 
	/** 
	 * Sets tag writer behavior to customize rendering of resolved messages 
	 *  
	 * @param tagWriterBehavior 
	 *            the tagWriterBehavior to set 
	 */ 
	public static void setTagWriterBehavior(TagMessageWriterBehavior tagWriterBehavior) { 
		OpenmrsMessageTag.tagWriterBehavior = tagWriterBehavior; 
	} 
	 
	/** 
	 * Very simple implementation of {@link TagMessageWriterBehavior} interface that is used by this class by default. It actually 
4
CodeRank
This code example shows how to use the following methods:getMessage
			Writer writer)
				throws TemplateException { 
		try { 
			if (exception.getCause().getClass() == NoSuchMessageException.class) {
				NoSuchMessageException ex = (NoSuchMessageException) exception.getCause();
				writer.write(ex.getMessage());
			} else { 
				writer.write("Error: ");
				writer.write(exception.getMessage());
			} 
		} catch (IOException ex) {
			log.warn(ex.getMessage(), ex);
		} 
		 
	} 
} 
4
CodeRank