Package java.util

Examples of java.util.ResourceBundle$CacheKeyReference


   * @param pobjLocale
   * @return
   */
  public static String getMsg(final String pstrKey, Locale pobjLocale) {
    try {
      ResourceBundle objBundle = ResourceBundle.getBundle(BUNDLE_NAME, pobjLocale);
      String strM = getString(pstrKey, objBundle);
      strM = pstrKey + ": " + strM;
      return strM;
    }
    catch (MissingResourceException e) {
View Full Code Here


   */
  protected ResourceBundle getResourceBundle() {
    setLocale(SOSOptionLocale.i18nLocale);
    Locale locale = getLocale();
    BundleBaseName basename = getBundleBaseName();
    ResourceBundle bundle = ResourceBundle.getBundle(basename.getBundleBaseName(), locale);

    return bundle;
  }
View Full Code Here

      enc.movePosition(buf, posOff, currentTokenStart, pos);
    posOff = currentTokenStart;
    String desc = id;
    String message = null;
    try {
      ResourceBundle resources
  = ResourceBundle.getBundle("com.jclark.xml.parse.Messages", locale);
      desc = resources.getString(id);
      if (args != null)
  desc = MessageFormat.format(desc, args);
      Object[] msgArgs = new Object[] { desc,
            location,
            new Integer(pos.getLineNumber()),
            new Integer(pos.getColumnNumber()),
            new Long(getEntityByteIndex(currentTokenStart))
            };
      message = MessageFormat.format(resources
             .getString(MessageId.MESSAGE_FORMAT),
             msgArgs);
    }
    catch (MissingResourceException e) {
      message = desc;
View Full Code Here

     * @param name of the desired bundle
     */
    public static int getBundleHandle(String name, ClassLoader cl) {

        Integer        bundleHandle;
        ResourceBundle bundle;
        String         bundleName;
        String         bundleKey;

        bundleName = prefix + name;

View Full Code Here

     * @param key A <code>String</code> key to a <code>String</code> value
     * @return The String value correspoding to the specified handle and key.
     */
    public static String getString(int handle, String key) {

        ResourceBundle bundle;
        String         s;

        synchronized (mutex) {
            if (handle < 0 || handle >= bundleList.size() || key == null) {
                bundle = null;
            } else {
                bundle = (ResourceBundle) bundleList.get(handle);
            }
        }

        if (bundle == null) {
            s = null;
        } else {
            try {
                s = bundle.getString(key);
            } catch (Exception e) {
                s = null;
            }
        }

View Full Code Here

  /**
   * Returns the string from the plugin's resource bundle,
   * or 'key' if not found.
   */
  public static String getResourceString(String key) {
    ResourceBundle bundle = DroolsIDEPlugin.getDefault().getResourceBundle();
    try {
      return (bundle != null) ? bundle.getString(key) : key;
    } catch (MissingResourceException e) {
      return key;
    }
  }
View Full Code Here

   * @param locale
   *            the locale the formatter must be constructed in.
   */
  public DurationFormatter(Locale locale) {
    super();
    ResourceBundle bundle = ResourceBundle.getBundle(getClass().getName(),
        locale);
    PeriodFormatterBuilder builder = new PeriodFormatterBuilder();
    builder.appendDays();
    builder.appendSuffix(" " + bundle.getString("day"), " "
        + bundle.getString("days"));
    builder.appendSeparator(" ");
    builder.appendHours();
    builder.appendSuffix(" " + bundle.getString("hour"), " "
        + bundle.getString("hours"));
    builder.appendSeparator(" ");
    builder.appendMinutes();
    builder.appendSuffix(" " + bundle.getString("minute"), " "
        + bundle.getString("minutes"));
    this.formatter = builder.toFormatter().withLocale(locale);
  }
View Full Code Here

          new ErrorResponse(t1);
        }
        JasperCompileManager.compileReport(new FileInputStream(jrxml));
      }

      ResourceBundle resourceBundle = null;
      try {
        resourceBundle = new PropertyResourceBundle(
            new FileInputStream(
              reportName+"_" + langId + ".properties"
            )
View Full Code Here

  this.componentName = componentName;
  this.optionName = optionName;
  this.currentValueIndex = currentValueIndex;
   
  ResourceBundle resource = null;
  try {
    String location = componentName.substring(0, componentName.lastIndexOf('.'));
    resource = ResourceBundle.getBundle(location + ".options", loc); //$NON-NLS-1$
  } catch (MissingResourceException e) {
    category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
    name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
    description = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
    possibleValues = CharOperation.NO_STRINGS;
    id = -1;
  }
  if (resource == null) return;
  try {
    id = Integer.parseInt(resource.getString(optionName + ".number")); //$NON-NLS-1$
  } catch (MissingResourceException e) {
    id = -1;
  } catch (NumberFormatException e) {
    id = -1;
  }
  try {
    category = resource.getString(optionName + ".category"); //$NON-NLS-1$
  } catch (MissingResourceException e) {
    category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
  }
  try {
    name = resource.getString(optionName + ".name"); //$NON-NLS-1$
  } catch (MissingResourceException e) {
    name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
  }
  try {
    StringTokenizer tokenizer = new StringTokenizer(resource.getString(optionName + ".possibleValues"), "|"); //$NON-NLS-1$ //$NON-NLS-2$
    int numberOfValues = Integer.parseInt(tokenizer.nextToken());
    if(numberOfValues == -1){
      possibleValues = NoDiscreteValue;
    } else {
      possibleValues = new String[numberOfValues];
      int index = 0;
      while (tokenizer.hasMoreTokens()) {
        possibleValues[index] = tokenizer.nextToken();
        index++;
      }
    }
  } catch (MissingResourceException e) {
    possibleValues = CharOperation.NO_STRINGS;
  } catch (NoSuchElementException e) {
    possibleValues = CharOperation.NO_STRINGS;
  } catch (NumberFormatException e) {
    possibleValues = CharOperation.NO_STRINGS;
  }
  try {
    description = resource.getString(optionName + ".description")//$NON-NLS-1$
  } catch (MissingResourceException e) {
    description = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
  }
}
View Full Code Here

      ResourceLocator.setBasename(null);
   }

   @Test
   public void testDefaultBundle() throws Exception {
      ResourceBundle bundle = ResourceLocator.getBundle();

      assertNotNull(bundle);
      Enumeration<String> keys = bundle.getKeys();
      assertFalse(keys.hasMoreElements());
   }
View Full Code Here

TOP

Related Classes of java.util.ResourceBundle$CacheKeyReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.