Bug 20197 - <sql:setDataSource> is not compliant with the 1.0 specification
Summary: <sql:setDataSource> is not compliant with the 1.0 specification
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-23 20:01 UTC by Felipe Leme
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felipe Leme 2003-05-23 20:01:38 UTC
The <sql:setDataSource> doesn't allow the definition of a scoped configuration
data source, i.e., a <sql:setDataSource> with attribute scope but without
atribute var.

I think the specification allows that (sorry if I misunderstood the
specification :), according to the definition of the scope atribute on section 10.6:

If var is specified, scope of the exported variable. Otherwise, scope of the
data source configuration variable.



The reason it doesn't work is that the JstlSqlTLV.java checks for dangling
scope, as changed in the bug below:


http://cvs.apache.org/viewcvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tlv/JstlSqlTLV.java.diff?r1=1.6&r2=1.7

The fix is pretty simple, it's only a matter of adding an exception for the
dangling rule to the setDataSource tag, as shown below:


[felipeal@localhost]/usr/local/java/jakarta-taglibs-src/standard-1.0.3/src/org/apache/taglibs/standard/tlv:
diff -u JstlSqlTLV.java JstlSqlTLV-patched.java
--- JstlSqlTLV.java     2003-05-23 16:47:41.000000000 -0300
+++ JstlSqlTLV-patched.java     2003-05-23 16:47:30.000000000 -0300
@@ -155,7 +155,8 @@
                     SCOPE, qn, a.getValue(SCOPE)));
            if (qn.startsWith(prefix + ":") && hasEmptyVar(a))
                fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
-           if (qn.startsWith(prefix + ":") && hasDanglingScope(a))
+
+           if (qn.startsWith(prefix + ":") && hasDanglingScope(a) &&
!qn.startsWith(prefix + ":" + SETDATASOURCE))
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));

            // now, modify state



Regards,

Felipe
Comment 1 Felipe Leme 2003-05-23 20:52:56 UTC
I forgot to mention, but it looks like the code's logic already handle what the
specifications says, the problem is really the TLV:

SetDataSourceTagSupport.java, method doStartTag:


        if (var != null) {
	    pageContext.setAttribute(var, ds, scope);
        } else {
            Config.set(pageContext, Config.SQL_DATA_SOURCE, ds, scope);
        }
Comment 2 Pierre Delisle 2003-05-28 00:32:17 UTC
Thanks for the report and the patch. This is now fixed.