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

This code example shows how to use the following methods:
 
		mockStatic(ResourceBundle.class);
		expect(ResourceBundle.getBundle("SomeBundleName", Locale.ENGLISH)).andReturn(bundle);
 
		final String key = "DUMMY";
		Exception e = new MissingResourceException(key, key, key);
		expect(bundle.getString(key)).andThrow(e);
 
		replayAll(); 
		instance.getResourceString(key);
	} 
 
	@Test(expected = MissingResourceException.class) 
	public final void testGetResourceStringWithBundleMissing() { 
 
		mockStatic(ResourceBundle.class);
		final String key = "DUMMY";
		Exception e = new MissingResourceException(key, key, key);
		expect(ResourceBundle.getBundle("SomeBundleName", Locale.ENGLISH)).andThrow(e);
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setStackTrace
            else { 
                return ResourceBundle.getBundle(this.errorBundleName, locale);
            } 
        } 
        catch (MissingResourceException mre) {
            MissingResourceException mre2 = new MissingResourceException(
                    "Could not find the error message resource bundle needed by Stripes. This " + 
                    "almost certainly means that a properties file called '" + 
                    this.errorBundleName + ".properties' could not be found in the classpath. " +
                    "This properties file is needed to lookup validation error messages. Please " + 
                    "ensure the file exists in WEB-INF/classes or elsewhere in your classpath.", 
                    this.errorBundleName, "");
            mre2.setStackTrace(mre.getStackTrace());
            throw mre2;
        } 
    } 
 
    /** 
     * Looks for a bundle called StripesResources with the supplied locale if one is provided, 
     * or with the default locale if the locale provided is null. 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
	@Override 
	protected Object handleGetObject(String k) {
		if (k.equals(key)) {
			return value;
		} 
		throw new MissingResourceException(k, value, key);
	} 
 
	@Override 
	public Enumeration<String> getKeys() {
		return Collections.enumeration(Collections.singleton(key));
	} 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage
        } 
 
        try { 
            return ResourceBundle.getBundle(resourceName);
        } catch (final MissingResourceException e) {
            logger.warn(e.getMessage());
            return EMPTY_RESOURCE_BUNDLE;
        } 
    } 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getClassName, getKey
        } catch (MissingResourceException e) {
            try { 
                return stockBundle.getString(key);
            } catch (MissingResourceException e1) {
                if (LOG.isWarnEnabled()) { 
                    LOG.warn("Cannot find resource " + e1.getKey() + " in bundle " + e1.getClassName());
                } 
                return ""; 
            } 
        } 
    } 
 
    private String escape(String message) {
        return message.replaceAll("'", "\\\\'");
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 MissingResourceException Questions & Answers:

See Code Examples for Java 8 MissingResourceException Methods: