modules/kernel/src/org/apache/axis2/i18n/RB.java [267:377]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        basePropertyFileName = basename + PROPERTY_EXT;

        if (p == null) {
            // The properties were not found in the cache. Search the given locale
            // first
            if (locale != null) {
                p = loadProperties(basename, loader, locale, p);
            }

            // Search the default locale
            if (defaultLocale != null) {
                p = loadProperties(basename, loader, defaultLocale, p);
            }

            // Search for the basename
            p = merge(p, loadProperties(basePropertyFileName, loader));

            if (p == null) {
                throw new MissingResourceException("Cannot find resource for base name " +
                        basePropertyFileName, basePropertyFileName, "");
            }

            // Cache the properties
            propertyCache.put(cacheKey, p);

        }

        resourceProperties = p;
    }

    protected Properties loadProperties(String basename, ClassLoader loader, Locale locale,
                                        Properties props) {

        String language = locale.getLanguage();
        String country = locale.getCountry();
        String variant = locale.getVariant();
        if (variant != null) {
            if (variant.trim().length() == 0) {
                variant = null;
            }
        }

        if (language != null) {

            if (country != null) {

                if (variant != null) {
                    props = merge(props, loadProperties(
                            basename + "_" + language + "_" + country + "_" + variant +
                                    PROPERTY_EXT, loader));
                }
                props = merge(props, loadProperties(basename + "_" + language + "_" + country +
                        PROPERTY_EXT, loader));
            }
            props = merge(props, loadProperties(basename + "_" + language + PROPERTY_EXT, loader));
        }
        return props;
    }

    protected Properties loadProperties(String resname, ClassLoader loader) {
        Properties props = null;

        // Attempt to open and load the properties
        InputStream in = null;
        try {
            if (loader != null) {
                in = loader.getResourceAsStream(resname);
            }

            // Either we're using the system class loader or we didn't find the
            // resource using the given class loader
            if (in == null) {
                in = ClassLoader.getSystemResourceAsStream(resname);
            }
            if (in != null) {
                props = new Properties();
                try {
                    props.load(in);
                } catch (IOException ex) {
                    // On error, clear the props
                    props = null;
                }
            }
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Exception ex) {
                    // Ignore error on close
                }
            }
        }
        return props;
    }

    /**
     * Merge two Properties objects
     */
    protected Properties merge(Properties p1, Properties p2) {
        if ((p1 == null) &&
                (p2 == null)) {
            return null;
        } else if (p1 == null) {
            return p2;
        } else if (p2 == null) {
            return p1;
        }

        // Now merge. p1 takes precedence
        Enumeration enumeration = p2.keys();
        while (enumeration.hasMoreElements()) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/metadata/src/org/apache/axis2/jaxws/i18n/RB.java [242:350]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        basePropertyFileName = basename + PROPERTY_EXT;

        if (p == null) {
            // The properties were not found in the cache. Search the given locale
            // first
            if (locale != null) {
                p = loadProperties(basename, loader, locale, p);
            }

            // Search the default locale
            if (defaultLocale != null) {
                p = loadProperties(basename, loader, defaultLocale, p);
            }

            // Search for the basename
            p = merge(p, loadProperties(basePropertyFileName, loader));

            if (p == null) {
                throw new MissingResourceException("Cannot find resource for base name " +
                        basePropertyFileName, basePropertyFileName, "");
            }

            // Cache the properties
            propertyCache.put(cacheKey, p);

        }

        resourceProperties = p;
    }

    protected Properties loadProperties(String basename, ClassLoader loader, Locale locale,
                                        Properties props) {

        String language = locale.getLanguage();
        String country = locale.getCountry();
        String variant = locale.getVariant();
        if (variant != null) {
            if (variant.trim().length() == 0) {
                variant = null;
            }
        }

        if (language != null) {

            if (country != null) {

                if (variant != null) {
                    props = merge(props, loadProperties(
                            basename + "_" + language + "_" + country + "_" + variant +
                                    PROPERTY_EXT, loader));
                }
                props = merge(props, loadProperties(basename + "_" + language + "_" + country +
                        PROPERTY_EXT, loader));
            }
            props = merge(props, loadProperties(basename + "_" + language + PROPERTY_EXT, loader));
        }
        return props;
    }

    protected Properties loadProperties(String resname, ClassLoader loader) {
        Properties props = null;

        // Attempt to open and load the properties
        InputStream in = null;
        try {
            if (loader != null) {
                in = loader.getResourceAsStream(resname);
            }

            // Either we're using the system class loader or we didn't find the
            // resource using the given class loader
            if (in == null) {
                in = ClassLoader.getSystemResourceAsStream(resname);
            }
            if (in != null) {
                props = new Properties();
                try {
                    props.load(in);
                } catch (IOException ex) {
                    // On error, clear the props
                    props = null;
                }
            }
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Exception ex) {
                    // Ignore error on close
                }
            }
        }
        return props;
    }

    /** Merge two Properties objects */
    protected Properties merge(Properties p1, Properties p2) {
        if ((p1 == null) &&
                (p2 == null)) {
            return null;
        } else if (p1 == null) {
            return p2;
        } else if (p2 == null) {
            return p1;
        }

        // Now merge. p1 takes precedence
        Enumeration enumeration = p2.keys();
        while (enumeration.hasMoreElements()) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



