modules/kernel/src/org/apache/axis2/i18n/ProjectResourceBundle.java [295:454]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    } else {
                        prb = new ProjectResourceBundle(name, parent);
                    }
                    if (log.isDebugEnabled()) {
                        log.debug("Root package not found, cross link to " + parent);
                    }
                }
            }

            if (prb != null) {
                // Cache the resource
                bundleCache.put(cacheKey, prb);
            }
        }

        return prb;
    }

    private static String getPackage(String name) {
        return name.substring(0, name.lastIndexOf('.')).intern();
    }

    /**
     * Construct a new ProjectResourceBundle
     */
    private ProjectResourceBundle(String name, ResourceBundle bundle)
            throws MissingResourceException {
        this.resourceBundle = bundle;
        this.resourceName = name;
    }

    public String getResourceName() {
        return resourceName;
    }

    /**
     * Clears the internal cache
     */
//    public static void clearCache() {
//        bundleCache.clear();
//    }
    public String toString() {
        return resourceName;
    }


    private static class Context {
        private Locale _locale;
        private ClassLoader _loader;
        private String _projectName;
        private String _resourceName;
        private ResourceBundle _parent;

        void setLocale(Locale l) {
            /* 1. Docs indicate that if locale is not specified,
             *    then the default local is used in it's place.
             * 2. A null value for locale is invalid.
             * 
             * Therefore, default...
             */
            _locale = (l == null) ? defaultLocale : l;
        }

        void setLoader(ClassLoader l) {
            _loader = (l != null) ? l : this.getClass().getClassLoader();
            // START FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868
            if (_loader == null) {
                _loader = ClassLoader.getSystemClassLoader();
            }
            // END FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868
        }

        void setProjectName(String name) {
            _projectName = name.intern();
        }

        void setResourceName(String name) {
            _resourceName = name.intern();
        }

        void setParentBundle(ResourceBundle b) {
            _parent = b;
        }

        Locale getLocale() {
            return _locale;
        }

        ClassLoader getLoader() {
            return _loader;
        }

        String getProjectName() {
            return _projectName;
        }

        String getResourceName() {
            return _resourceName;
        }

        ResourceBundle getParentBundle() {
            return _parent;
        }

        String getCacheKey(String packageName) {
            String loaderName = (_loader == null) ? "" : (":" + _loader.hashCode());
            return packageName + "." + _resourceName + ":" + _locale + ":" + defaultLocale +
                    loaderName;
        }

        ResourceBundle loadBundle(String packageName) {
            try {
                return ResourceBundle.getBundle(packageName + '.' + _resourceName,
                                                _locale,
                                                _loader);
            } catch (MissingResourceException e) {
                // Deliberately surpressing print stack.. just the string for info.
                log.debug("loadBundle: Ignoring MissingResourceException: " + e.getMessage());
            }
            return null;
        }

        ResourceBundle getParentBundle(String packageName) {
            ResourceBundle p;
            if (!packageName.equals(_projectName)) {
                p = getBundle(this, getPackage(packageName));
            } else {
                p = _parent;
                _parent = null;
            }
            return p;
        }

        String validate(String packageName)
                throws MissingResourceException {
            if (_projectName == null || _projectName.length() == 0) {
                log.debug("Project name not specified");
                throw new MissingResourceException("Project name not specified",
                                                   "", "");
            }

            if (packageName == null || packageName.length() == 0) {
                log.debug("Package name not specified");
                throw new MissingResourceException("Package not specified",
                                                   packageName, "");
            }
            packageName = packageName.intern();

            /* Ensure that project is a proper prefix of class.
            * Terminate project name with '.' to ensure proper match.
            */
            if (!packageName.equals(_projectName) && !packageName.startsWith(_projectName + '.')) {
                log.debug("Project not a prefix of Package");
                throw new MissingResourceException("Project '" + _projectName
                        + "' must be a prefix of Package '"
                        + packageName + "'",
                                                   packageName + '.' + _resourceName, "");
            }

            return packageName;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/metadata/src/org/apache/axis2/jaxws/i18n/ProjectResourceBundle.java [273:428]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    } else {
                        prb = new ProjectResourceBundle(name, parent);
                    }
                    if (log.isDebugEnabled()) {
                        log.debug("Root package not found, cross link to " + parent);
                    }
                }
            }

            if (prb != null) {
                // Cache the resource
                bundleCache.put(cacheKey, prb);
            }
        }

        return prb;
    }

    private static String getPackage(String name) {
        return name.substring(0, name.lastIndexOf('.')).intern();
    }

    /** Construct a new ProjectResourceBundle */
    private ProjectResourceBundle(String name, ResourceBundle bundle)
            throws MissingResourceException {
        this.resourceBundle = bundle;
        this.resourceName = name;
    }

    public String getResourceName() {
        return resourceName;
    }

    /** Clears the internal cache */
//    public static void clearCache() {
//        bundleCache.clear();
//    }
    public String toString() {
        return resourceName;
    }


    private static class Context {
        private Locale _locale;
        private ClassLoader _loader;
        private String _projectName;
        private String _resourceName;
        private ResourceBundle _parent;

        void setLocale(Locale l) {
            /* 1. Docs indicate that if locale is not specified,
             *    then the default local is used in it's place.
             * 2. A null value for locale is invalid.
             * 
             * Therefore, default...
             */
            _locale = (l == null) ? defaultLocale : l;
        }

        void setLoader(ClassLoader l) {
            _loader = (l != null) ? l : this.getClass().getClassLoader();
            // START FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868
            if (_loader == null) {
                _loader = ClassLoader.getSystemClassLoader();
            }
            // END FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868
        }

        void setProjectName(String name) {
            _projectName = name.intern();
        }

        void setResourceName(String name) {
            _resourceName = name.intern();
        }

        void setParentBundle(ResourceBundle b) {
            _parent = b;
        }

        Locale getLocale() {
            return _locale;
        }

        ClassLoader getLoader() {
            return _loader;
        }

        String getProjectName() {
            return _projectName;
        }

        String getResourceName() {
            return _resourceName;
        }

        ResourceBundle getParentBundle() {
            return _parent;
        }

        String getCacheKey(String packageName) {
            String loaderName = (_loader == null) ? "" : (":" + _loader.hashCode());
            return packageName + "." + _resourceName + ":" + _locale + ":" + defaultLocale +
                    loaderName;
        }

        ResourceBundle loadBundle(String packageName) {
            try {
                return ResourceBundle.getBundle(packageName + '.' + _resourceName,
                                                _locale,
                                                _loader);
            } catch (MissingResourceException e) {
                // Deliberately surpressing print stack.. just the string for info.
                log.debug("loadBundle: Ignoring MissingResourceException: " + e.getMessage());
            }
            return null;
        }

        ResourceBundle getParentBundle(String packageName) {
            ResourceBundle p;
            if (!packageName.equals(_projectName)) {
                p = getBundle(this, getPackage(packageName));
            } else {
                p = _parent;
                _parent = null;
            }
            return p;
        }

        String validate(String packageName)
                throws MissingResourceException {
            if (_projectName == null || _projectName.length() == 0) {
                log.debug("Project name not specified");
                throw new MissingResourceException("Project name not specified",
                                                   "", "");
            }

            if (packageName == null || packageName.length() == 0) {
                log.debug("Package name not specified");
                throw new MissingResourceException("Package not specified",
                                                   packageName, "");
            }
            packageName = packageName.intern();

            /* Ensure that project is a proper prefix of class.
            * Terminate project name with '.' to ensure proper match.
            */
            if (!packageName.equals(_projectName) && !packageName.startsWith(_projectName + '.')) {
                log.debug("Project not a prefix of Package");
                throw new MissingResourceException("Project '" + _projectName
                        + "' must be a prefix of Package '"
                        + packageName + "'",
                                                   packageName + '.' + _resourceName, "");
            }

            return packageName;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



