Example usage for java.util MissingResourceException getMessage

List of usage examples for java.util MissingResourceException getMessage

Introduction

In this page you can find the example usage for java.util MissingResourceException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.nuxeo.ecm.activity.ActivityStreamServiceImpl.java

@Override
public ActivityMessage toActivityMessage(Activity activity, Locale locale, String activityLinkBuilderName) {
    ActivityLinkBuilder activityLinkBuilder = getActivityLinkBuilder(activityLinkBuilderName);

    Map<String, String> fields = activity.toMap();

    String actor = activity.getActor();
    String displayActor = activity.getDisplayActor();
    String displayActorLink;// w w w.  j a v  a2  s.com
    if (ActivityHelper.isUser(actor)) {
        displayActorLink = activityLinkBuilder.getUserProfileLink(actor, activity.getDisplayActor());
    } else {
        displayActorLink = activity.getDisplayActor();
    }

    List<ActivityReplyMessage> activityReplyMessages = toActivityReplyMessages(activity.getActivityReplies(),
            locale, activityLinkBuilderName);

    ActivityVerb verb = activityVerbRegistry.get(activity.getVerb());

    if (verb == null || verb.getLabelKey() == null) {
        return new ActivityMessage(activity.getId(), actor, displayActor, displayActorLink, activity.getVerb(),
                activity.toString(), activity.getPublishedDate(), null, activityReplyMessages);
    }

    String labelKey = verb.getLabelKey();
    String messageTemplate;
    try {
        messageTemplate = I18NUtils.getMessageString("messages", labelKey, null, locale);
    } catch (MissingResourceException e) {
        log.error(e.getMessage());
        log.debug(e, e);
        // just return the labelKey if we have no resource bundle
        return new ActivityMessage(activity.getId(), actor, displayActor, displayActorLink, activity.getVerb(),
                labelKey, activity.getPublishedDate(), verb.getIcon(), activityReplyMessages);
    }

    Pattern pattern = Pattern.compile("\\$\\{(.*?)\\}");
    Matcher m = pattern.matcher(messageTemplate);
    while (m.find()) {
        String param = m.group().replaceAll("[\\|$\\|{\\}]", "");
        if (fields.containsKey(param)) {
            String value = fields.get(param);
            final String displayValue = fields.get("display" + StringUtils.capitalize(param));
            if (ActivityHelper.isDocument(value)) {
                value = activityLinkBuilder.getDocumentLink(value, displayValue);
            } else if (ActivityHelper.isUser(value)) {
                value = activityLinkBuilder.getUserProfileLink(value, displayValue);
            } else {
                // simple text
                value = ActivityMessageHelper.replaceURLsByLinks(value);
            }
            messageTemplate = messageTemplate.replace(m.group(), value);
        }
    }

    return new ActivityMessage(activity.getId(), actor, displayActor, displayActorLink, activity.getVerb(),
            messageTemplate, activity.getPublishedDate(), verb.getIcon(), activityReplyMessages);
}

From source file:cf.spring.servicebroker.ServiceBrokerHandler.java

@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    if (!authenticator.authenticate(request, response)) {
        return;//from  ww  w  .  j  a  v  a  2s .  co  m
    }
    ApiVersionValidator.validateApiVersion(request);
    try {
        response.setContentType(Constants.JSON_CONTENT_TYPE);
        final Matcher matcher = URI_PATTERN.matcher(request.getRequestURI());
        if (!matcher.matches()) {
            throw new NotFoundException("Resource not found");
        }
        final String instanceId = matcher.group(1);
        final String bindingId = matcher.group(3);
        if ("put".equalsIgnoreCase(request.getMethod())) {
            if (bindingId == null) {
                final ProvisionBody provisionBody = mapper.readValue(request.getInputStream(),
                        ProvisionBody.class);
                final String serviceId = provisionBody.getServiceId();
                final BrokerServiceAccessor accessor = getServiceAccessor(serviceId);
                final ProvisionRequest provisionRequest = new ProvisionRequest(UUID.fromString(instanceId),
                        provisionBody.getPlanId(), provisionBody.getOrganizationGuid(),
                        provisionBody.getSpaceGuid());
                final ProvisionResponse provisionResponse = accessor.provision(provisionRequest);
                if (provisionResponse.isCreated()) {
                    response.setStatus(HttpServletResponse.SC_CREATED);
                }
                mapper.writeValue(response.getOutputStream(), provisionResponse);
            } else {
                final BindBody bindBody = mapper.readValue(request.getInputStream(), BindBody.class);
                final String serviceId = bindBody.getServiceId();
                final BrokerServiceAccessor accessor = getServiceAccessor(serviceId);

                final BindRequest bindRequest = new BindRequest(UUID.fromString(instanceId),
                        UUID.fromString(bindingId), bindBody.applicationGuid, bindBody.getPlanId());
                final BindResponse bindResponse = accessor.bind(bindRequest);
                if (bindResponse.isCreated()) {
                    response.setStatus(HttpServletResponse.SC_CREATED);
                }
                mapper.writeValue(response.getOutputStream(), bindResponse);
            }
        } else if ("delete".equalsIgnoreCase(request.getMethod())) {
            final String serviceId = request.getParameter(SERVICE_ID_PARAM);
            final String planId = request.getParameter(PLAN_ID_PARAM);
            final BrokerServiceAccessor accessor = getServiceAccessor(serviceId);
            try {
                if (bindingId == null) {
                    // Deprovision
                    final DeprovisionRequest deprovisionRequest = new DeprovisionRequest(
                            UUID.fromString(instanceId), planId);
                    accessor.deprovision(deprovisionRequest);
                } else {
                    // Unbind
                    final UnbindRequest unbindRequest = new UnbindRequest(UUID.fromString(bindingId),
                            UUID.fromString(instanceId), planId);
                    accessor.unbind(unbindRequest);
                }
            } catch (MissingResourceException e) {
                response.setStatus(HttpServletResponse.SC_GONE);
            }
            response.getWriter().write("{}");
        } else {
            response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
        }
    } catch (ConflictException e) {
        response.setStatus(HttpServletResponse.SC_CONFLICT);
        response.getWriter().write("{}");
    } catch (ServiceBrokerException e) {
        LOGGER.warn("An error occurred processing a service broker request", e);
        response.setStatus(e.getHttpResponseCode());
        mapper.writeValue(response.getOutputStream(), new ErrorBody(e.getMessage()));
    } catch (Throwable e) {
        LOGGER.error(e.getMessage(), e);
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        mapper.writeValue(response.getOutputStream(), new ErrorBody(e.getMessage()));
    }
}

From source file:org.exoplatform.wcm.webui.clv.UICLVPresentation.java

/**
 * This method will put the mandatory html code to manage QuickEdit mode
 *
 * @param cssClass//from  w  ww.  j  a v  a2s.c o m
 * @param viewNode
 * @return
 * @throws Exception
 */
public String addQuickEditDiv(String cssClass, Node viewNode) throws Exception {
    StringBuffer sb = new StringBuffer();
    String contentEditLink = getEditLink(viewNode, true, false);
    String contentDeleteLink = event("DeleteContent", NodeLocation.getExpressionByNode(viewNode));
    String fastPublishLink = event("FastPublish", NodeLocation.getExpressionByNode(viewNode));
    String hoverClass = Utils.isShowQuickEdit() ? " containerHoverClassInner" : "";
    PortletRequestContext portletRequestContext = WebuiRequestContext.getCurrentInstance();
    sb.append("<div class=\"" + cssClass + " " + hoverClass + " \">");
    if (Utils.isShowQuickEdit()) {
        sb.append("  <div class=\"edittingContent\" style=\" z-index: 5\">");
        sb.append("    <div class=\"edittingToolBar clearfix\" >");

        sb.append("    <div class=\"btn-group\" >");

        if (isShowEdit(viewNode) && !LockUtil.isLocked(viewNode)) {
            String strEditBundle = "Edit in the Content Explorer";
            try {
                strEditBundle = portletRequestContext.getApplicationResourceBundle()
                        .getString("UICLVPresentation.action.edit");
            } catch (MissingResourceException e) {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(e.getMessage());
                }
            }
            if (org.exoplatform.wcm.webui.utils.Utils.isShowFastPublish(viewNode)) {
                String strFastPublishBundle = "Publish";
                try {
                    strFastPublishBundle = portletRequestContext.getApplicationResourceBundle()
                            .getString("UICLVPresentation.action.publish");
                } catch (MissingResourceException e) {
                    if (LOG.isWarnEnabled()) {
                        LOG.warn(e.getMessage());
                    }
                }
                sb.append("          <a class=\"btn\" href=\"" + fastPublishLink
                        + "\" rel=\"tooltip\" data-placement=\"bottom\" title=\"" + strFastPublishBundle
                        + "\">");
                sb.append("            <i class=\"uiIconEcmsPublish\" ></i>");
                sb.append("          </a>");
            }
            sb.append(
                    "          <a class=\"btn\" onclick = 'eXo.ecm.CLV.addURL(this)' href=\"" + contentEditLink
                            + "\" rel=\"tooltip\" data-placement=\"bottom\" title=\"" + strEditBundle + "\">");
            sb.append("            <i class=\"uiIconEdit\"></i>");
            sb.append("          </a>");
        } else {
            sb.append("          <a class=\"btn\" >");
            sb.append("            <i class=\"uiIconEcmsLock\" ></i>");
            sb.append("          </a>");
        }

        if (Utils.isShowDelete(viewNode)) {
            String strDeleteBundle = "Delete";
            try {
                strDeleteBundle = portletRequestContext.getApplicationResourceBundle()
                        .getString("UICLVPresentation.action.delete");
            } catch (MissingResourceException e) {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(e.getMessage());
                }
            }
            sb.append("          <a class=\"btn\" href=\"" + contentDeleteLink
                    + "\"  rel=\"tooltip\" data-placement=\"bottom\" title=\"" + strDeleteBundle + "\">");
            sb.append("            <i class=\"uiIconRemove\"></i>");
            sb.append("          </a>");
        }

        sb.append("    </div>");

        if (viewNode.hasProperty("publication:currentState")) {
            String state = viewNode.getProperty("publication:currentState").getValue().getString();
            try {
                state = portletRequestContext.getApplicationResourceBundle()
                        .getString("PublicationStates." + state);
            } catch (MissingResourceException e) {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(e.getMessage());
                }
            }
            sb.append("<div class=\"edittingCurrentState pull-left\">");
            if (UIEditingForm.PUBLISHED.equals(state)) {
                sb.append("<span class=\"publishText\"><i class=\"uiIconTick\"></i>" + state + "</span>");
            } else if (UIEditingForm.DRAFT.equals(state)) {
                sb.append("<span class=\"draftText\">" + state + "</span>");
            } else {
                sb.append("<span>" + state + "</span>");
            }
            sb.append(" </div>");
        }

        sb.append("      </div>");
        sb.append("    </div>");
    }

    return sb.toString();
}

From source file:architecture.ee.plugin.impl.PluginManagerImpl.java

public ResourceBundle getPluginResourceBundle(Plugin plugin, Locale locale) {

    ResourceBundle bundle = null;
    PluginClassLoader loader = getPluginClassloader(plugin);
    try {/*from ww w  . ja  v a2s  .c o  m*/
        bundle = ResourceBundle.getBundle("plugin_i18n", locale, loader.getClassLoader());
    } catch (MissingResourceException e) {
        bundle = null;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    return bundle;

}

From source file:org.exoplatform.wcm.connector.fckeditor.DriverConnector.java

private String resolveDriveLabel(String name, String lang) {
    if (resourceBundleService == null) {
        resourceBundleService = WCMCoreUtils.getService(ResourceBundleService.class);
        resourceBundleNames = resourceBundleService.getSharedResourceBundleNames();
        sharedResourceBundle = resourceBundleService.getResourceBundle(resourceBundleNames, this.lang);
    }//w ww.  j  a va 2s  . com
    try {
        if (!this.lang.getLanguage().equals(lang)) {
            this.lang = new Locale(lang);
            sharedResourceBundle = resourceBundleService.getResourceBundle(resourceBundleNames, this.lang);
        }
        return sharedResourceBundle.getString("ContentSelector.title." + name.replaceAll(" ", ""));
    } catch (MissingResourceException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(e.getMessage());
        }
    }
    return name;
}

From source file:org.displaytag.properties.TableProperties.java

/**
 * Returns the configured Locale Resolver. This method is called before the loading of localized properties.
 * @return LocaleResolver instance.//from w ww. j  a v  a  2 s . c  o  m
 * @throws TablePropertiesLoadException if the default <code>TableTag.properties</code> file is not found.
 */
public static LocaleResolver getLocaleResolverInstance() throws TablePropertiesLoadException {
    // special handling, table properties is not yet instantiated
    String className = null;

    ResourceBundle defaultUserProperties = loadUserProperties(Locale.getDefault());

    // if available, user properties have higher precedence
    if (defaultUserProperties != null) {
        try {
            className = defaultUserProperties.getString(PROPERTY_CLASS_LOCALERESOLVER);
        } catch (MissingResourceException e) {
            // no problem
        }
    }

    // still null? load defaults
    if (className == null) {
        Properties defaults = loadBuiltInProperties();
        className = defaults.getProperty(PROPERTY_CLASS_LOCALERESOLVER);
    }

    if (localeResolver == null) {
        if (className != null) {
            try {
                Class classProperty = ReflectHelper.classForName(className);
                localeResolver = (LocaleResolver) classProperty.newInstance();

                log.info(Messages.getString("TableProperties.classinitializedto", //$NON-NLS-1$
                        new Object[] { ClassUtils.getShortClassName(LocaleResolver.class), className }));
            } catch (Throwable e) {
                log.warn(Messages.getString("TableProperties.errorloading", //$NON-NLS-1$
                        new Object[] { ClassUtils.getShortClassName(LocaleResolver.class),
                                e.getClass().getName(), e.getMessage() }));
            }
        } else {
            log.info(Messages.getString("TableProperties.noconfigured", //$NON-NLS-1$
                    new Object[] { ClassUtils.getShortClassName(LocaleResolver.class) }));
        }

        // still null?
        if (localeResolver == null) {
            // fallback locale resolver
            localeResolver = new LocaleResolver() {

                public Locale resolveLocale(HttpServletRequest request) {
                    return request.getLocale();
                }
            };
        }
    }

    return localeResolver;
}

From source file:org.dspace.workflowbasic.BasicWorkflowServiceImpl.java

/**
 * notify the submitter that the item is archived
 *
 * @param context//from  w  w  w.j a v  a 2  s  . c o m
 *     The relevant DSpace Context.
 * @param item
 *     which item was archived
 * @param coll
 *     collection name to display in template
 * @throws SQLException
 *     An exception that provides information on a database access error or other errors.
 * @throws IOException
 *     A general class of exceptions produced by failed or interrupted I/O operations.
 */
protected void notifyOfArchive(Context context, Item item, Collection coll) throws SQLException, IOException {
    try {
        // Get submitter
        EPerson ep = item.getSubmitter();
        // Get the Locale
        Locale supportedLocale = I18nUtil.getEPersonLocale(ep);
        Email email = Email.getEmail(I18nUtil.getEmailFilename(supportedLocale, "submit_archive"));

        // Get the item handle to email to user
        String handle = handleService.findHandle(context, item);

        // Get title
        String title = item.getName();
        if (StringUtils.isBlank(title)) {
            try {
                title = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled");
            } catch (MissingResourceException e) {
                title = "Untitled";
            }
        }

        email.addRecipient(ep.getEmail());
        email.addArgument(title);
        email.addArgument(coll.getName());
        email.addArgument(handleService.getCanonicalForm(handle));

        email.send();
    } catch (MessagingException e) {
        log.warn(LogManager.getHeader(context, "notifyOfArchive",
                "cannot email user; item_id=" + item.getID() + ":  " + e.getMessage()));
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Create the application.// www.j  ava 2s.  c  o  m
 * 
 * @throws ConfigReadWriteException
 * @throws IOException
 */
public MainCommGUI() throws IOException, ConfigReadWriteException {
    lg = SpxPcloggerProgramConfig.LOGGER;
    setDefaultLookAndFeelDecorated(isDefaultLookAndFeelDecorated());
    // Konfiguration aus der Datei einlesen
    // bercksichtigt schon per CLI angegebene Werte als gesetzt
    new ReadConfig();
    makeLogger();
    //
    // gib ein paar informationen
    //
    lg.info("Operating System: <" + OperatingSystemDetector.getOsName() + ">");
    lg.info("Java VM Datamodel: " + OperatingSystemDetector.getDataModel() + " bits");
    lg.info("Java VM Datamodel: <" + OperatingSystemDetector.getArch() + ">");
    //
    // Grundstzliche Sachen einstellen
    //
    try {
        ResourceBundle.clearCache();
        if (SpxPcloggerProgramConfig.langCode != null) {
            lg.info("try make locale from cmd options <" + SpxPcloggerProgramConfig.langCode + ">...");
            programLocale = new Locale(SpxPcloggerProgramConfig.langCode);
        } else {
            lg.debug("try get locale from system...");
            programLocale = Locale.getDefault();
        }
        LangStrings.setLocale(programLocale);
        lg.debug(String.format("getLocale says: Display Language :<%s>, lang: <%s>",
                programLocale.getDisplayLanguage(), programLocale.getLanguage()));
        stringsBundle = ResourceBundle.getBundle("de.dmarcini.submatix.pclogger.lang.messages", programLocale);
        if (stringsBundle.getLocale().equals(programLocale)) {
            lg.debug("language accepted..");
        } else {
            lg.debug("language fallback default...");
            programLocale = Locale.ENGLISH;
            Locale.setDefault(programLocale);
            stringsBundle = ResourceBundle.getBundle("de.dmarcini.submatix.pclogger.lang.messages",
                    programLocale);
        }
        checkDatabaseDirectory();
    } catch (MissingResourceException ex) {
        lg.error("ERROR get resources <" + ex.getMessage() + "> try standart Strings...");
        System.err.println("ERROR get resources <" + ex.getMessage() + "> try standart Strings...");
        try {
            lg.debug("try get  default english locale from system...");
            programLocale = Locale.ENGLISH;
            Locale.setDefault(programLocale);
            stringsBundle = ResourceBundle.getBundle("de.dmarcini.submatix.pclogger.lang.messages_en");
        } catch (Exception ex1) {
            lg.error("ERROR get resources <" + ex1.getMessage() + "> give up...");
            System.exit(-1);
        }
    } catch (NoDatabaseException ex) {
        showErrorDialog(ex.getLocalizedMessage());
        System.exit(-1);
    }
    //
    // jetzt die wichtigen anderen Sachen, die dauern.
    //
    prepareDatabase();
    currentConfig.setLogger(lg);
    btComm = new BTCommunication(databaseUtil);
    btComm.addActionListener(this);
    try {
        initializeGUI();
    } catch (SQLException ex) {
        lg.error("SQL ERROR <" + ex.getMessage() + "> give up...");
        System.err.println("ERROR while create GUI: <" + ex.getLocalizedMessage() + ">");
        ex.printStackTrace();
        System.exit(-1);
    } catch (ClassNotFoundException ex) {
        lg.error("CLASS NOT FOUND EXCEPTION <" + ex.getMessage() + "> give up...");
        System.err.println("ERROR while create GUI: <" + ex.getLocalizedMessage() + ">");
        ex.printStackTrace();
        System.exit(-1);
    }
    // Listener setzen (braucht auch die Maps)
    setGlobalChangeListener();
    //
    initLanuageMenu(programLocale);
    if (!SpxPcloggerProgramConfig.developDebug) {
        configPanel.setAllConfigPanlelsEnabled(false);
        logListPanel.setAllLogPanelsEnabled(false);
        setElementsConnected(false);
    }
    if (setLanguageStrings() < 1) {
        lg.error("setLanguageStrings() faild. give up...");
        System.exit(-1);
    }
    connectionPanel.setVirtDevicesBoxEnabled(false);
    startVirtualPortFinder(null);
    waitForMessage = 0;
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Setze alle Strings im Form Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui
 * // www . j  av  a  2  s .  c o  m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 18.12.2011
 */
private int setLanguageStrings() {
    // so, ignoriere mal alles....
    ignoreAction = true;
    lg.debug("setLanguageStrings( ) START...");
    try {
        stringsBundle = ResourceBundle.getBundle("de.dmarcini.submatix.pclogger.lang.messages", programLocale);
        lg.debug("setLanguageStrings( ) get stringsBundle OK......");
    } catch (MissingResourceException ex) {
        lg.error("setLanguageStrings( ) get stringsBundle ERROR! <" + ex.getMessage() + ">");
        System.out.println("ERROR get resources <" + ex.getMessage() + "> ABORT!");
        return (-1);
    }
    try {
        setStatus("");
        timeFormatterString = LangStrings.getString("MainCommGUI.timeFormatterString");
        // Hauptfenster
        frmMainWindow.setTitle(LangStrings.getString("MainCommGUI.frmMainwindowtitle.title"));
        // Men
        mnFile.setText(LangStrings.getString("MainCommGUI.mnFile.text"));
        mnFile.setToolTipText(LangStrings.getString("MainCommGUI.mnFile.tooltiptext"));
        mntmExit.setText(LangStrings.getString("MainCommGUI.mntmExit.text"));
        mntmExit.setToolTipText(LangStrings.getString("MainCommGUI.mntmExit.tooltiptext"));
        mnLanguages.setText(LangStrings.getString("MainCommGUI.mnLanguages.text"));
        mnLanguages.setToolTipText(LangStrings.getString("MainCommGUI.mnLanguages.tooltiptext"));
        mnOptions.setText(LangStrings.getString("MainCommGUI.mnOptions.text"));
        mnOptions.setToolTipText(LangStrings.getString("MainCommGUI.mnOptions.tooltiptext"));
        mntmOptions.setText(LangStrings.getString("MainCommGUI.mntmOptions.text"));
        mntmOptions.setToolTipText(LangStrings.getString("MainCommGUI.mntmOptions.tooltiptext"));
        mnHelp.setText(LangStrings.getString("MainCommGUI.mnHelp.text"));
        mnHelp.setToolTipText(LangStrings.getString("MainCommGUI.mnHelp.tooltiptext"));
        mntmHelp.setText(LangStrings.getString("MainCommGUI.mntmHelp.text"));
        mntmHelp.setToolTipText(LangStrings.getString("MainCommGUI.mntmHelp.tooltiptext"));
        mntmInfo.setText(LangStrings.getString("MainCommGUI.mntmInfo.text"));
        mntmInfo.setToolTipText(LangStrings.getString("MainCommGUI.mntmInfo.tooltiptext"));
        // //////////////////////////////////////////////////////////////////////
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Panes
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane connect
        tabbedPane.setTitleAt(programTabs.TAB_CONNECT.ordinal(),
                LangStrings.getString("spx42ConnectPanel.title"));
        connectionPanel.setLanguageStrings(stringsBundle, btComm.isConnected());
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane config
        tabbedPane.setTitleAt(programTabs.TAB_CONFIG.ordinal(),
                LangStrings.getString("spx42ConfigPanel.title"));
        configPanel.setLanguageStrings(currentConfig);
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane gas
        tabbedPane.setTitleAt(programTabs.TAB_GASLIST.ordinal(),
                LangStrings.getString("spx42GaslistEditPanel.title"));
        gasConfigPanel.setLanguageStrings();
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane log
        tabbedPane.setTitleAt(programTabs.TAB_LOGREAD.ordinal(),
                LangStrings.getString("spx42LoglistPanel.title"));
        logListPanel.setLanguageStrings();
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane graph
        tabbedPane.setTitleAt(programTabs.TAB_LOGGRAPH.ordinal(),
                LangStrings.getString("spx42LogGraphPanel.title"));
        logGraphPanel.setLanguageStrings();
        // //////////////////////////////////////////////////////////////////////
        // Tabbed Pane import/export
        tabbedPane.setTitleAt(programTabs.TAB_FILEMANAGER.ordinal(),
                LangStrings.getString("fileManagerPanel.title"));
        fileManagerPanel.setLanguageStrings();
    } catch (NullPointerException ex) {
        lg.error("setLanguageStrings( ) NULLPOINTER EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings");
        System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
        return (-1);
    } catch (MissingResourceException ex) {
        lg.error("setLanguageStrings( ) MISSING RESOURCE EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings - the given key can be found");
        System.out.println(
                "ERROR set language strings - the given key can be found <" + ex.getMessage() + "> ABORT!");
        return (0);
    } catch (ClassCastException ex) {
        lg.error("setLanguageStrings( ) CLASS CAST EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings");
        System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
        return (0);
    } finally {
        ignoreAction = false;
    }
    lg.debug("setLanguageStrings( ) END.");
    return (1);
}

From source file:org.apache.myfaces.application.ApplicationImpl.java

@Override
public final java.util.ResourceBundle getResourceBundle(final FacesContext facesContext, final String name)
        throws FacesException, NullPointerException {

    checkNull(facesContext, "facesContext");
    checkNull(name, "name");

    final String bundleName = getBundleName(facesContext, name);

    if (bundleName == null) {
        return null;
    }/*from  w w w.j  av a  2 s.co  m*/

    Locale locale = Locale.getDefault();

    final UIViewRoot viewRoot = facesContext.getViewRoot();
    if (viewRoot != null && viewRoot.getLocale() != null) {
        locale = viewRoot.getLocale();
    }

    try {
        return getResourceBundle(bundleName, locale, getClassLoader());
    } catch (MissingResourceException e) {
        try {
            return getResourceBundle(bundleName, locale, this.getClass().getClassLoader());
        } catch (MissingResourceException e1) {
            throw new FacesException(
                    "Could not load resource bundle for name '" + name + "': " + e.getMessage(), e1);
        }
    }
}