Hello all,

I have encountered another possible bug - 0.8.0.

I have created a TagSupport object and an associated TagExtraInfo object.  I
have two attributes for the tag - "id" and "url".  In the taglib descriptor file
taglib.tld, attribute "id" is set as required, "url" is not required.

In the .jsp file the following works fine:

<test:testtag id="xyz" url="abc" />

However, if I do not specify the optional attribute "url":

<test:testtag id="xyz" />

the following exception is thrown:

=================================
500 Internal Server Error

java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java, Compiled Code)
        at cs.ka(JAX, Compiled Code)
        at cs.i1(JAX, Compiled Code)
        at com.evermind.server.http.JSPPage.i1(JAX)
        at com.evermind.server.http.HttpApplication.ll(JAX)
        at com.evermind.server.http.HttpApplication.l7(JAX)
        at com.evermind.server.http.JSPServlet.service(JAX)
        at cm.i_(JAX)
        at cm.forward(JAX)
        at cw.ky(JAX, Compiled Code)
        at c.run(JAX, Compiled Code)
=================================

No reference to the "url" attribute is made in my TagExtraInfo object.

Once again, if I am doing something wrong, please advise.

Thanks for any help!

Evan Vaala

Here is my code:

=================TestTag.java=====================
package taglib;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.ServletRequest;

public class TestTag extends TagSupport
{
        private String id="";
        private String url="";

        public TestTag() {
                super();
        }

        public void setId( String id ) {
                this.id = id;
        }

        public void setUrl( String url ) {
                this.url = url;
        }

        public int doStartTag() throws JspError {
                String st = this.url;
                pageContext.setAttribute( id, st );
                return SKIP_BODY;
        }

}

=================TestTagExtraInfo.java=========================
package taglib;
import javax.servlet.jsp.tagext.*;

public class TestTagExtraInfo extends TagExtraInfo 
{
    public TestTagExtraInfo() 
    {
        super();
    }

    public VariableInfo[] getVariableInfo(TagData data)
    {
        return new VariableInfo[] 
            {
                new VariableInfo(data.getAttributeString("id"),
                                 "java.lang.String",
                                 true,
                                 VariableInfo.AT_END),
            };
    }

} // TurboBufferTagExtraInfo

===============taglib.tld - testtag section===========
        <tag>   
                <name>testtag</name>
                <tagclass>taglib.TestTag</tagclass>
                <teiclass>taglib.TestTagExtraInfo</teiclass>
                <bodycontent>none</bodycontent>
                <info>A demo loop tag</info>

                <attribute>
                        <name>id</name>
                        <required>true</required>
                        <rtexprvalue>true</rtexprvalue>
                </attribute>
                <attribute>
                        <name>url</name>
                        <required>false</required>
                        <rtexprvalue>true</rtexprvalue>
                </attribute>
        </tag>

Reply via email to