This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197597 - Incorrect error flagging by netbeans in facelets converter attributes
Summary: Incorrect error flagging by netbeans in facelets converter attributes
Status: RESOLVED DUPLICATE of bug 195591
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-10 19:45 UTC by geraldolmr
Modified: 2011-11-16 16:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project file to verify the bug (17.06 KB, application/x-zip-compressed)
2011-04-10 19:45 UTC, geraldolmr
Details
Screen capture showing the "error" flagged by netbeans (267.36 KB, image/jpeg)
2011-04-10 19:47 UTC, geraldolmr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geraldolmr 2011-04-10 19:45:49 UTC
Created attachment 107626 [details]
Project file to verify the bug

This bug came from http://netbeans.org/bugzilla/show_bug.cgi?id=172520#c48. Mr. Fukala told me to set another entry for it, so here I am.

The problem is when I define a converter with attributes using facelets tablib, Netbeans flags an error indicating that the attribute is not defined in the component's interface, but, with facelets converters (and validators), explicit parameter definition is not required any more (I guess).

On the bug #172520, comment #22, 2010-03-17, user jpleed3 pointed out:
"Also, in the taglib test I attached, on lines 11 and 13 of index.xhtml, the
rendered attribute is flagged as an error, saying "The attribute rendered is
not defined in the component's interface"
The component doesn't have an interface since one can't exactly be defined for
it. In that case, I don't think it should be shown as an error. If anything is
shown, it should be a warning at most."

Marek Fukala replied on post #27, 2010-06-01:
"That is the only remaining problem I found in going through this long issue
and I'll try to fix it."

I'm using versions 6.9.1 and the problem is still there. The only
attribute NetBeans identifies is "id" when you use ctrl-space (code assistant)
in the custom tag. Despite of being flagged as error by NetBeans, the value of
the attribute is passed to the component at runtime and it works fine, but the
error flagging in this case can confuse the user.
Comment 1 geraldolmr 2011-04-10 19:47:35 UTC
Created attachment 107627 [details]
Screen capture showing the "error" flagged by netbeans
Comment 2 Marek Fukala 2011-04-11 14:57:25 UTC
If there's no facelets tag library descriptor, the error checks for its tags must be disabled.
Comment 3 geraldolmr 2011-04-11 19:32:31 UTC
But a file named converter.taglib.xml is present on converter-test\web\WEB-INF\ folder with this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE facelet-taglib PUBLIC
  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
  "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">

<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">

  <namespace>http://glmr.org/conv</namespace>

  <tag>
    <tag-name>conv</tag-name>
    <converter>
      <converter-id>convId</converter-id>
    </converter>
  </tag>

</facelet-taglib>

Isn't it enough for a converter to be defined and registered when using facelets?

So, I think netbeans shouldn't have flagged this as an error and, futhermore, it should also have listed the name of the tag's attribute on its content assistant drop-down list (control-space).
Comment 4 geraldolmr 2011-04-11 19:39:26 UTC
The faces-config.xml file:

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    </application>
    <converter>
        <converter-id>convId</converter-id>
        <converter-class>MyConverter</converter-class>
    </converter>
</faces-config>

and the web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/converter.taglib.xml</param-value>
    </context-param>

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>
Comment 5 Marek Fukala 2011-04-18 14:32:12 UTC
(In reply to comment #3)
> But a file named converter.taglib.xml is present on converter-test\web\WEB-INF
> Isn't it enough for a converter to be defined and registered when using
> facelets?
> 
Yes, that's enough for the runtime not doing any pre-run checks but not for tools since there isn't an information that such attribute may be used. If a tag declaration is found in a facelets descriptor I expect that the declaration is complete, in another works that if the instance has some set-able attributes they are also declared in the descriptor. I may possibly disable the unknown attribute check if there isn't any declared for a tag.
Comment 6 geraldolmr 2011-04-20 20:15:53 UTC
But is it possible to define attributes for a component/converter/validator in facelets taglib file? 

I don't see a place to include them, according to the DTD:

<!ELEMENT facelet-taglib (library-class|(namespace,(tag|function)+))>
<!ATTLIST facelet-taglib xmlns CDATA #FIXED "http://java.sun.com/JSF/Facelet">
<!ELEMENT namespace (#PCDATA)>
<!ELEMENT library-class (#PCDATA)>
<!ELEMENT tag (tag-name,(handler-class|component|converter|validator|source))>
<!ELEMENT tag-name (#PCDATA)>
<!ELEMENT handler-class (#PCDATA)>
<!ELEMENT component (component-type,renderer-type?,handler-class?)>
<!ELEMENT component-type (#PCDATA)>
<!ELEMENT renderer-type (#PCDATA)>
<!ELEMENT converter (converter-id, handler-class?)>
<!ELEMENT converter-id (#PCDATA)>
<!ELEMENT validator (validator-id, handler-class?)>
<!ELEMENT validator-id (#PCDATA)>
<!ELEMENT source (#PCDATA)>
<!ELEMENT function (function-name,function-class,function-signature)>
<!ELEMENT function-name (#PCDATA)>
<!ELEMENT function-class (#PCDATA)>
<!ELEMENT function-signature (#PCDATA)>

Where should I put the attributes declaration so Netbeans can find it and also consider it in its content assistant?
Comment 7 Marek Fukala 2011-05-16 14:11:29 UTC
(In reply to comment #6)
> But is it possible to define attributes for a component/converter/validator in
> facelets taglib file? 
> 
You are using very old facelets library definition schema. Try to use a fresher one:

http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd
Comment 8 Marek Fukala 2011-05-16 14:21:55 UTC
The original issue has been already fixed - see http://netbeans.org/bugzilla/show_bug.cgi?id=195591#c4

The fix should be part of 7.0 release. Have you checked the behavior there already?

*** This bug has been marked as a duplicate of bug 195591 ***