Summary: | Providing a javax.sql.DataSource object to the datasource attribute of the setDataSource action fails. | ||
---|---|---|---|
Product: | Taglibs | Reporter: | Ryan Lubke <Ryan.Lubke> |
Component: | Standard Taglib | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Corrects ClassCastExceptions in SetDataSourceTagSupport |
Description
Ryan Lubke
2002-04-18 22:38:46 UTC
Ryan, I'm not sure I understand the bug report. The following works for me: <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> <%! public static class Foo implements javax.sql.DataSource { public java.sql.Connection getConnection() { return null; } public java.sql.Connection getConnection(String a, String b) { return null; } public int getLoginTimeout() { return 0; } public java.io.PrintWriter getLogWriter() { return null; } public void setLoginTimeout(int a) { } public void setLogWriter(java.io.PrintWriter a) { } } %> <% pageContext.setAttribute("myDataSource", new Foo()); %> <sql:setDataSource var="new" dataSource="${myDataSource}" /> --- Is the problem that the driver within the String representation of a DataSource you're passing isn't valid? If so, that's an issue we're waiting on spec clarification for. I beleive the problem could be related to the fact that our DataSource overrides the toString() method. The Error message reported shows the result of calling that method. Created attachment 1631 [details]
Corrects ClassCastExceptions in SetDataSourceTagSupport
Actually, it appears Jan corrected this issue already. The ExpressionManager was configured to evaluate as a String instead of an Object. However, there is now an issue with ClassCastExceptions being raised. I've atteched a patch to this bug that corrects the issue. Fixed: - Applied Ryan's patch (thanks, Ryan!) - Also removed DataSourceUtil constructor, in which a DataSourceWrapper was allocated. This was out-of-date, since the wrapper now is allocated inside setUsingParams(). |