java.util.MissingResourceException#printStackTrace ( )源码实例Demo

下面列出了java.util.MissingResourceException#printStackTrace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bisq   文件: Res.java
public static String get(String key) {
    try {
        return resourceBundle.getString(key)
                .replace("BTC", baseCurrencyCode)
                .replace("Bitcoin", baseCurrencyName)
                .replace("bitcoin", baseCurrencyNameLowerCase);
    } catch (MissingResourceException e) {
        log.warn("Missing resource for key: {}", key);
        e.printStackTrace();
        if (DevEnv.isDevMode())
            UserThread.runAfter(() -> {
                // We delay a bit to not throw while UI is not ready
                throw new RuntimeException("Missing resource for key: " + key);
            }, 1);

        return key;
    }
}
 
源代码2 项目: netbeans   文件: SimpleContainerProvider.java
public String getDisplayName(Object containerType, String containerCtx) {
    try {
        return bundle.getString(containerCtx);
    } catch (MissingResourceException mre) {
        mre.printStackTrace();
        return containerCtx;
    }
}
 
源代码3 项目: netbeans   文件: SimpleActionProvider.java
public String getDisplayName(String actionName, String containerCtx) {
    try {
        return bundle.getString(actionName);
    } catch (MissingResourceException mre) {
        mre.printStackTrace();
        return actionName;
    }
}
 
源代码4 项目: netbeans   文件: RestoreDefaultValueTest.java
private AbstractButton findResetToDefaultButton(JDialog jd) {
    String txt = null;
    try {
        txt = NbBundle.getMessage(PropertyDialogManager.class, "CTL_Default");
    } catch (MissingResourceException mre) {
        mre.printStackTrace();
        fail("Bundle key CTL_DEFAULT missing from org.openide.explorer.propertysheet.Bundle.properties");
    }
    return findButton(jd.getContentPane(), txt);
}
 
源代码5 项目: openjdk-jdk9   文件: Main.java
public static void main(String[] args) throws Exception {
    int errors = 0;
    for (String loctag : args) {
        Locale locale = Locale.forLanguageTag(loctag);
        if (locale.equals(Locale.ROOT)) {
            continue;
        }
        ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
                                                     locale);
        String tag = locale.toLanguageTag(); // normalized
        String value = rb.getString("key");
        System.out.println(rb.getBaseBundleName() + ": locale = " + tag + ", value = " + value);
        if (!value.startsWith(tag + ':')) {
            System.out.println("ERROR: " + value + " expected: " + tag);
            errors++;
        }

        // inaccessible bundles
        try {
            ResourceBundle.getBundle("jdk.test.internal.resources.Foo", locale);
            System.out.println("ERROR: jdk.test.internal.resources.Foo should not be accessible");
            errors++;
        } catch (MissingResourceException e) {
            e.printStackTrace();

            Throwable cause = e.getCause();
            System.out.println("Expected: " +
                (cause != null ? cause.getMessage() : e.getMessage()));
        }
    }
    if (errors > 0) {
        throw new RuntimeException(errors + " errors");
    }
}
 
源代码6 项目: opensim-gui   文件: AboutJPanel.java
/** Loads an about image from its source */
private Image loadImage(String urlString) {
    try {
        URL u = getClass().getResource(urlString);
        return Toolkit.getDefaultToolkit().getImage(u);
    } catch (MissingResourceException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
源代码7 项目: birt   文件: Messages.java
/**
 * @param key
 * @param oa
 * @param lcl
 */
public static String getString( String key, Object[] oa, ULocale lcl )
{
	try
	{
		return SecurityUtil.formatMessage( getResourceBundle( lcl ).getString( key ),
				oa );
	}
	catch ( MissingResourceException e )
	{
		e.printStackTrace( );
		return '!' + key + '!';
	}
}
 
源代码8 项目: birt   文件: Messages.java
/**
 * @param key
 * @param oa
 * @param lcl
 */
public static String getString( String key, Object[] oa, ULocale lcl )
{
	try
	{
		return SecurityUtil.formatMessage( getResourceBundle( lcl ).getString( key ),
				oa );
	}
	catch ( MissingResourceException e )
	{
		e.printStackTrace( );
		return '!' + key + '!';
	}
}
 
源代码9 项目: birt   文件: Messages.java
/**
 * @param key
 * @param oa
 * @param lcl
 */
public static String getString( String key, Object[] oa, ULocale lcl )
{
	try
	{
		return SecurityUtil.formatMessage( getResourceBundle( lcl ).getString( key ),
				oa );
	}
	catch ( MissingResourceException e )
	{
		e.printStackTrace( );
		return '!' + key + '!';
	}
}
 
源代码10 项目: birt   文件: Messages.java
/**
 * @param key
 * @param oa
 * @param lcl
 */
public static String getString( String key, Object[] oa, ULocale lcl )
{
	try
	{
		return SecurityUtil.formatMessage( getResourceBundle( lcl ).getString( key ),
				oa );
	}
	catch ( MissingResourceException e )
	{
		e.printStackTrace( );
		return '!' + key + '!';
	}
}
 
源代码11 项目: netbeans   文件: LabeledTextFieldDialog.java
/** Creates new form LabeledTextFieldDialog */
public LabeledTextFieldDialog(String notes) 
{
    String title = NbBundle.getMessage (LabeledTextFieldDialog.class, "RecreateTableRenameTable"); // NOI18N
    String lab = NbBundle.getMessage (LabeledTextFieldDialog.class, "RecreateTableNewName"); // NOI18N
    original_notes = notes;
    
    initComponents();
    
    try
    {
        Mnemonics.setLocalizedText(titleLabel, lab);
        titleLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (LabeledTextFieldDialog.class, "ACS_RecreateTableNewNameA11yDesc"));  // NOI18N

        Mnemonics.setLocalizedText(descLabel, NbBundle.getMessage (LabeledTextFieldDialog.class, "RecreateTableRenameNotes")); // NOI18N
        descLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (LabeledTextFieldDialog.class, "ACS_RecreateTableRenameNotesA11yDesc"));  // NOI18N
        Mnemonics.setLocalizedText(editButton, NbBundle.getMessage (LabeledTextFieldDialog.class, "EditCommand")); // NOI18N
        editButton.setToolTipText(NbBundle.getMessage (LabeledTextFieldDialog.class, "ACS_EditCommandA11yDesc"));  // NOI18N

        updateState();

        ActionListener listener = new ActionListener() 
        {
            public void actionPerformed(ActionEvent event) 
            {
                result = event.getSource() == DialogDescriptor.OK_OPTION;
            }
        };

        getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (LabeledTextFieldDialog.class, "ACS_RecreateTableDialogA11yDesc")); // NOI18N

        DialogDescriptor descriptor = new DialogDescriptor(this, title, true, listener);
        dialog = DialogDisplayer.getDefault().createDialog(descriptor);
        dialog.setResizable(true);
    }
    catch (MissingResourceException e)
    {
        e.printStackTrace();
    }

}
 
源代码12 项目: Saiy-PS   文件: SaiyTextToSpeech.java
/**
 * Attempt to resolve the voice that most suits the conditions and the user's preferences.
 *
 * @param language   the {@link Locale} language
 * @param region     the {@link Locale} region
 * @param conditions the {@link SelfAwareConditions}
 * @param params     the {@link SelfAwareParameters}
 * @return one of {@link #SUCCESS} or {@link #ERROR}
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private int resolveVoice(@NonNull final String language, @NonNull final String region,
                         @NonNull final SelfAwareConditions conditions, @NonNull final SelfAwareParameters params,
                         @Nullable final SaiyVoice currentVoice) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "resolveVoice");
    }

    final Pair<SaiyVoice, Locale> voicePair = new TTSVoice(language, region, conditions, params,
            currentVoice).buildVoice();

    if (voicePair.first != null) {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "resolveVoice: Setting Voice: " + voicePair.first.toString());
            MyLog.i(CLS_NAME, "resolveVoice: Setting Voice loc: " + voicePair.first.getLocale());
            try {
                MyLog.i(CLS_NAME, "resolveVoice: Setting Voice: isLanguageAvailable: "
                        + resolveSuccess(isLanguageAvailable(new Locale(voicePair.first.getLocale().getLanguage(),
                        voicePair.first.getLocale().getCountry()))));
            } catch (final MissingResourceException e) {
                MyLog.w(CLS_NAME, "MissingResourceException: isLanguageAvailable failed");
                e.printStackTrace();
            }
        }

        return super.setVoice(voicePair.first);
    } else {
        if (voicePair.second != null) {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "resolveVoice: Setting Locale deprecated");
            }
            return setVoiceDeprecated(voicePair.second.getLanguage(), voicePair.second.getCountry());
        } else {
            if (DEBUG) {
                MyLog.w(CLS_NAME, "resolveVoice: voicePair.second null: falling back");
            }
            return resolveSuccess(super.setLanguage(new Locale(language, region)));
        }
    }
}