Bug 26614 - XPathUtil.JstlVariableContext.notNull ignores prefix arg value for exception messasge
Summary: XPathUtil.JstlVariableContext.notNull ignores prefix arg value for exception ...
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.1
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-02 19:52 UTC by Kris Schneider
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kris Schneider 2004-02-02 19:52:38 UTC
The current code for XPathUtil.JstlVariableContext.notNull looks like:

        private Object notNull(Object o, String prefix, String localName)
        throws UnresolvableException {
            if (o == null) {
                throw new UnresolvableException("$" +
(prefix==null?"":"prefix"+":") + localName);
            }
            //p("resolved to: " + o);
            return o;
        }

Which means that if the prefix arg is non-null, the exception message will
always include the literal string "prefix" as opposed to the arg's value. The
fix is to do something like:

        private Object notNull(Object o, String prefix, String localName)
        throws UnresolvableException {
            if (o == null) {
                throw new UnresolvableException("$" +
(prefix==null?"":prefix+":") + localName);
            }
            //p("resolved to: " + o);
            return o;
        }

I can't create a diff/patch while at work, but the fix is pretty simple. I'll
try to upload a diff tonight unless somebody else beats me to it...
Comment 1 Felipe Leme 2004-03-10 03:44:50 UTC
Fixed (sorry, beat it while cleaning up other bugs :-)

MAIN BRANCH
------------

diff -r1.16 XPathUtil.java
363c363
<                 throw new UnresolvableException("$" +
(prefix==null?"":"prefix"+":") + localName);
---
>                 throw new UnresolvableException("$" +
(prefix==null?"":prefix+":") + localName);

BRANCH_1.0
-----------
diff -r1.8.2.2 XPathUtil.java
158,159c158,160
<           if (o == null)
<               throw new UnresolvableException("$" + prefix + ":" + localName);---
>             if (o == null) {
>                 throw new UnresolvableException("$" +
(prefix==null?"":prefix+":") + localName);
>             }