jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15989] New: - NPE using message tag with arguments
Date Sat, 11 Jan 2003 07:38:44 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15989>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15989

NPE using message tag with arguments

           Summary: NPE using message tag with arguments
           Product: Taglibs
           Version: 1.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: I18N Taglib
        AssignedTo: taglibs-dev@jakarta.apache.org
        ReportedBy: xschinnerlx@webdynamite.com


Dear Jakarta-Team,

I've a small problem with the i18n taglib. If I use the message tag with
arguments (example below) I get a NullPointerException (NPE). (Environment:
Linux, Java 1.4.1_01, JBoss 3.0.4/Jetty)

However if I change line 268 of the MessageTag class (change shown below)
everything works fine (the NPE doesn't occur anymore). To me the change makes
sense, but maybe it breaks something which I'm not aware of.

If I can be of any help, please let me know.

Best regards,
Dietmar

---- JSP snippet ----

[...]
<i18n:bundle i18n="bundle" baseName="com.sony.emo2.backoffice.Texts"
localeRef="<%= com.sony.framework.command.BaseCommand.LOCALE %>" />
[...]
            <%  
            if (pageTitle != null) {
            %>
              <h1><i18n:message key="<%= pageTitle %>" /></h1>

              <%
               Object[] args = new Object[] { "abcdef" };
              %>
              <i18n:message bundleRef="bundle" key="<%= pageTitle %>" args="<%=
args %>" />
            <%
            }
            %>
[...]

---- log4j snippet ----

[...]
2003-01-11 08:17:55,646 WARN  [org.jboss.jbossweb] (SocketListener-1:) WARNING:
Exception for /emo2bo/command.jsp?cmd=login
java.lang.NullPointerException
        at org.apache.taglibs.i18n.MessageTag.doEndTag(MessageTag.java:268)
        at org.apache.jsp.menu$jsp._jspService(menu$jsp.java:563)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
[...]

---- diff ----

[dietmar@wd1w i18n]$ cvs diff -u src/org/apache/taglibs/i18n/MessageTag.java 
Index: src/org/apache/taglibs/i18n/MessageTag.java
===================================================================
RCS file:
/home/cvspublic/jakarta-taglibs/i18n/src/org/apache/taglibs/i18n/MessageTag.java,v
retrieving revision 1.5
diff -u -r1.5 MessageTag.java
--- src/org/apache/taglibs/i18n/MessageTag.java 17 Dec 2002 04:18:59 -0000      1.5
+++ src/org/apache/taglibs/i18n/MessageTag.java 11 Jan 2003 07:29:28 -0000
@@ -265,7 +265,7 @@
             // perform parameter substitutions
             if ( _value != null && _arguments != null && _arguments.size()
> 0) {
                 // reformat the value as specified
-                _messageFormat.setLocale(_bundle.getLocale());
+                _messageFormat.setLocale(getBundle().getLocale());
                 _messageFormat.applyPattern(_value);
                 _value = _messageFormat.format(_arguments.toArray());
             }

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message