Examples of UTF8Control


Examples of com.github.dandelion.core.utils.UTF8Control

      String path = System.getProperty(SystemConstants.DANDELION_DT_CONFIGURATION);

      try {
        URL resourceURL = new File(path).toURI().toURL();
        URLClassLoader urlLoader = new URLClassLoader(new URL[] { resourceURL });
        userBundle = ResourceBundle.getBundle(DT_USER_PROPERTIES, locale, urlLoader, new UTF8Control());
      }
      catch (MalformedURLException e) {
        logger.warn("Wrong path to the externalized bundle", e);
      }
      catch (MissingResourceException e) {
        logger.info("No *.properties file in {}. Trying to lookup in classpath...", path);
      }
    }

    // No system property is set, retrieves the bundle from the classpath
    if (userBundle == null) {
      try {
        userBundle = ResourceBundle.getBundle(DT_USER_PROPERTIES_LOCATION + DT_USER_PROPERTIES, locale,
            new UTF8Control());
      }
      catch (MissingResourceException e) {
        // if no resource bundle is found, try using the context
        // classloader
        try {
          userBundle = ResourceBundle.getBundle(DT_USER_PROPERTIES_LOCATION + DT_USER_PROPERTIES, locale,
              Thread.currentThread().getContextClassLoader(), new UTF8Control());
        }
        catch (MissingResourceException mre) {
          logger.debug("No custom configuration. Using default one.");
        }
      }
View Full Code Here

Examples of com.github.dandelion.core.utils.UTF8Control

      try {
        URL resourceURL = new File(path).toURI().toURL();
        URLClassLoader urlLoader = new URLClassLoader(new URL[] { resourceURL });
        userBundle = ResourceBundle.getBundle(DANDELION_USER_PROPERTIES, Locale.getDefault(), urlLoader,
            new UTF8Control());
        LOG.debug("User configuration loaded");
      }
      catch (MalformedURLException e) {
        LOG.warn("Wrong path to the externalized bundle", e);
      }
      catch (MissingResourceException e) {
        LOG.info("No *.properties file in {}. Trying to lookup in classpath...", path);
      }
    }

    // No system property is set, retrieves the bundle from the classpath
    if (userBundle == null) {
      try {
        // The user bundle is read using UTF-8
        userBundle = ResourceBundle
            .getBundle(DANDELION_USER_PROPERTIES, Locale.getDefault(), new UTF8Control());
        LOG.debug("User configuration loaded");
      }
      catch (MissingResourceException e) {
        // if no resource bundle is found, try using the context
        // classloader
        try {
          userBundle = ResourceBundle.getBundle("dandelion/" + DANDELION_USER_PROPERTIES,
              Locale.getDefault(), Thread.currentThread().getContextClassLoader(), new UTF8Control());
          LOG.debug("User configuration loaded");
        }
        catch (MissingResourceException mre) {
          LOG.debug("No custom configuration. Using default one.");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.