Return-Path: Delivered-To: apmail-jakarta-taglibs-dev-archive@apache.org Received: (qmail 81264 invoked from network); 17 Apr 2002 20:48:21 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 17 Apr 2002 20:48:21 -0000 Received: (qmail 28040 invoked by uid 97); 17 Apr 2002 20:48:13 -0000 Delivered-To: qmlist-jakarta-archive-taglibs-dev@jakarta.apache.org Received: (qmail 27974 invoked by uid 97); 17 Apr 2002 20:48:13 -0000 Mailing-List: contact taglibs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tag Libraries Developers List" Reply-To: "Tag Libraries Developers List" Delivered-To: mailing list taglibs-dev@jakarta.apache.org Received: (qmail 27898 invoked by uid 97); 17 Apr 2002 20:48:12 -0000 Date: 17 Apr 2002 20:48:04 -0000 Message-ID: <20020417204804.34459.qmail@icarus.apache.org> From: luehe@apache.org To: jakarta-taglibs-cvs@apache.org Subject: cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt BundleSupport.java SetBundleSupport.java SetLocaleSupport.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N luehe 02/04/17 13:48:04 Modified: standard/src/org/apache/taglibs/standard/tag/common/fmt BundleSupport.java SetBundleSupport.java SetLocaleSupport.java Log: Fixed 8224: NPE occurs if basename attribute of setBundle is null or empty Revision Changes Path 1.24 +10 -13 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java Index: BundleSupport.java =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- BundleSupport.java 17 Apr 2002 18:35:34 -0000 1.23 +++ BundleSupport.java 17 Apr 2002 20:48:03 -0000 1.24 @@ -170,7 +170,7 @@ locCtxt = (LocalizationContext) obj; } else { // localization context is a bundle basename - locCtxt = BundleSupport.getLocalizationContext(pc, (String) obj); + locCtxt = getLocalizationContext(pc, (String) obj); } return locCtxt; @@ -199,8 +199,8 @@ * * @return Localization context containing the resource bundle with the * given base name for which a match between the preferred (or fallback) - * and available locales exists, or empty localization context containing - * the null bundle if no resource bundle match was found + * and available locales exists, or null if no resource bundle match was + * found */ public static LocalizationContext getLocalizationContext(PageContext pc, String basename) { @@ -242,16 +242,13 @@ // do nothing } } - - if (locCtxt == null) { - // create empty localization context - locCtxt = new LocalizationContext(); - } - - bundle = locCtxt.getResourceBundle(); - if (bundle != null) { - // set response locale - SetLocaleSupport.setResponseLocale(pc, bundle.getLocale()); + + if (locCtxt != null) { + bundle = locCtxt.getResourceBundle(); + if (bundle != null) { + // set response locale + SetLocaleSupport.setResponseLocale(pc, bundle.getLocale()); + } } return locCtxt; 1.5 +5 -0 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java Index: SetBundleSupport.java =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SetBundleSupport.java 16 Apr 2002 15:49:50 -0000 1.4 +++ SetBundleSupport.java 17 Apr 2002 20:48:03 -0000 1.5 @@ -124,6 +124,11 @@ basename); } + if (locCtxt == null) { + // create empty localization context + locCtxt = new LocalizationContext(); + } + if (var != null) { pageContext.setAttribute(var, locCtxt, Util.getScope(scope)); } else { 1.6 +8 -6 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java Index: SetLocaleSupport.java =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SetLocaleSupport.java 16 Apr 2002 18:17:51 -0000 1.5 +++ SetLocaleSupport.java 17 Apr 2002 20:48:03 -0000 1.6 @@ -265,13 +265,15 @@ Tag parent = findAncestorWithClass(fromTag, BundleSupport.class); if (parent != null) { // use locale from parent tag - locCtxt = ((BundleSupport) parent).getLocalizationContext(); - ResourceBundle bundle = locCtxt.getResourceBundle(); - if (bundle != null) { - if (format) { - setResponseLocale(pc, bundle.getLocale()); + if ((locCtxt = ((BundleSupport) parent).getLocalizationContext()) + != null) { + ResourceBundle bundle = locCtxt.getResourceBundle(); + if (bundle != null) { + if (format) { + setResponseLocale(pc, bundle.getLocale()); + } + return bundle.getLocale(); } - return bundle.getLocale(); } } -- To unsubscribe, e-mail: For additional commands, e-mail: