Package java.util

Examples of java.util.MissingResourceException


          @Override
          protected Object handleGetObject(String key) {
            try {
              return preferences.getLocalizedString(furnitureCatalogFamily, key);
            } catch (IllegalArgumentException ex) {
              throw new MissingResourceException("Unknown key " + key,
                  furnitureCatalogFamily + "_" + Locale.getDefault(), key);
            }
          }
         
          @Override
View Full Code Here


   * @see de.odysseus.calyxo.base.I18nSupport#lookupResource(java.util.Locale, java.lang.String, java.lang.String)
   */
  protected String lookupResource(Locale locale, String bundle, String key) {
    MessageResources resources = getResources(bundle);
    if (resources == null) {
      throw new MissingResourceException("No such bundle: '" + bundle + "'", bundle, null);
    }
    String result = resources.getMessage(locale, key);
    if (resources == null) {
      throw new MissingResourceException("No such resource: '" + bundle + ":" + key + "'", bundle, key);
    }
    return result;
  }
View Full Code Here

   * @see de.odysseus.calyxo.base.I18nSupport#lookupMessage(java.util.Locale, java.lang.String, java.lang.String, java.lang.Object[])
   */
  protected String lookupMessage(Locale locale, String bundle, String key, Object[] values) {
    MessageResources resources = getResources(bundle);
    if (resources == null) {
      throw new MissingResourceException("No such bundle: '" + bundle + "'", bundle, null);
    }
    String result = resources.getMessage(locale, key, values);
    if (resources == null) {
      throw new MissingResourceException("No such resource: '" + bundle + ":" + key + "'", bundle, key);
    }
    return result;
  }
View Full Code Here

      }
    }
   
    // Cannot find
    if(resourceBundle == null) {
      throw new MissingResourceException("No such bundle could be located for " + basename, basename, "");
    }
   
    return resourceBundle;
  }
View Full Code Here

    Object key = Pool.createHashKeys(new Object[] {resourceName, baseURI});
    Document doc = entries.getDocument(key);
    if (doc == null) {
      InputStream input = resolver.getResourceAsStream(resourceName);
      if (input == null) {
        throw new MissingResourceException(
          "Resource '" + resourceName + "' could not be found by resolver: " +
          resolver.getClass().getName(),
          resolver.getClass().getName(),
          resourceName);
      }
View Full Code Here

    Object key = Pool.createHashKeys(new Object[] {resourceName, baseURI, null});
    XQuery xquery = (XQuery) entries.get(key);
    if (xquery == null) {
      InputStream query = resolver.getResourceAsStream(resourceName);
      if (query == null) {
        throw new MissingResourceException(
          "Resource '" + resourceName + "' could not be found by resolver: " +
          resolver.getClass().getName(),
          resolver.getClass().getName(),
          resourceName);
      }
View Full Code Here

    Object key = Pool.createHashKeys(new Object[] {resourceName, baseURI});
    XSLTransform transform = (XSLTransform) entries.get(key);
    if (transform == null) {
      InputStream stylesheet = resolver.getResourceAsStream(resourceName);
      if (stylesheet == null) {
        throw new MissingResourceException(
          "Resource '" + resourceName + "' could not be found by resolver: " +
          resolver.getClass().getName(),
          resolver.getClass().getName(),
          resourceName);
      }
View Full Code Here

     * or throw a MissingResourceException.
     */
    static private RefCapablePropertyResourceBundle getRef(String baseName,
            ResourceBundle rb, ClassLoader loader) {
        if (!(rb instanceof PropertyResourceBundle))
            throw new MissingResourceException(
                    "Found a Resource Bundle, but it is a "
                            + rb.getClass().getName(),
                    PropertyResourceBundle.class.getName(), null);
        if (allBundles.containsKey(rb)) return allBundles.get(rb);
        RefCapablePropertyResourceBundle newPRAFP =
View Full Code Here

        int bytesread = 0;
        int retval;
        InputStream  inputStream =
                getMostSpecificStream(key, language, country, variant);
        if (inputStream == null)
            throw new MissingResourceException(
                    "Key '" + key
                    + "' is present in .properties file with no value, yet "
                    + "text file resource is missing",
                    RefCapablePropertyResourceBundle.class.getName(), key);
        try {
            try {
                ba = new byte[inputStream.available()];
            } catch (RuntimeException re) {
                throw new MissingResourceException(
                    "Resource is too big to read in '" + key + "' value in one "
                    + "gulp.\nPlease run the program with more RAM "
                    + "(try Java -Xm* switches).: " + re,
                    RefCapablePropertyResourceBundle.class.getName(), key);
            } catch (IOException ioe) {
                throw new MissingResourceException(
                    "Failed to read in value for key '" + key + "': " + ioe,
                    RefCapablePropertyResourceBundle.class.getName(), key);
            }
            try {
                while (bytesread < ba.length &&
                        (retval = inputStream.read(
                                ba, bytesread, ba.length - bytesread)) > 0) {
                    bytesread += retval;
                }
            } catch (IOException ioe) {
                throw new MissingResourceException(
                    "Failed to read in value for '" + key + "': " + ioe,
                    RefCapablePropertyResourceBundle.class.getName(), key);
            }
        } finally {
            try {
                inputStream.close();
            } catch (IOException ioe) {
                System.err.println("Failed to close input stream: " + ioe);
            }
        }
        if (bytesread != ba.length) {
            throw new MissingResourceException(
                    "Didn't read all bytes.  Read in "
                      + bytesread + " bytes out of " + ba.length
                      + " bytes for key '" + key + "'",
                    RefCapablePropertyResourceBundle.class.getName(), key);
        }
        try {
            return new String(ba, "ISO-8859-1");
        } catch (UnsupportedEncodingException uee) {
            throw new RuntimeException(uee);
        } catch (RuntimeException re) {
            throw new MissingResourceException(
                "Value for key '" + key + "' too big to convert to String.  "
                + "Please run the program with more RAM "
                + "(try Java -Xm* switches).: " + re,
                RefCapablePropertyResourceBundle.class.getName(), key);
        }
View Full Code Here

                    break;
                case JExifTag.GPSTAG_TAG_ALTITUDE:
                    int ref = data.getGPSAltitudeRef();
                    if (ref>=0)
                        ref = ref != 0 ? -1 : 1;
                    else throw new MissingResourceException(null, null, null);
                    float f = data.getGPSAltitude();
                    if (Float.isNaN(f))
                        throw new MissingResourceException(null, null, null);
                    else
                        obj = String.format("%.1f m", ref*f, Main.getString("data_gps_altitude_unit"));
                    break;
                case JExifTag.GPSTAG_TAG_TIMESTAMP:
                    strBuf = new StringBuffer();
View Full Code Here

TOP

Related Classes of java.util.MissingResourceException

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.