View | Details | Raw Unified | Return to bug 8283
Collapse All | Expand All

(-)SetDataSourceTagSupport.java (-7 / +9 lines)
Lines 60-65 Link Here
60
import javax.servlet.jsp.*;
60
import javax.servlet.jsp.*;
61
import javax.servlet.jsp.jstl.sql.*;
61
import javax.servlet.jsp.jstl.sql.*;
62
import javax.servlet.jsp.tagext.*;
62
import javax.servlet.jsp.tagext.*;
63
import javax.sql.DataSource;
63
import javax.servlet.jsp.jstl.core.Config;
64
import javax.servlet.jsp.jstl.core.Config;
64
import org.apache.taglibs.standard.tag.common.core.Util;
65
import org.apache.taglibs.standard.tag.common.core.Util;
65
import org.apache.taglibs.standard.resources.Resources;
66
import org.apache.taglibs.standard.resources.Resources;
Lines 103-130 Link Here
103
    // Tag logic
104
    // Tag logic
104
105
105
    public int doStartTag() throws JspException {
106
    public int doStartTag() throws JspException {
106
        DataSourceWrapper ds;
107
        DataSource ds;
107
108
108
        if (dataSource != null) {
109
        if (dataSource != null) {
109
            DataSourceUtil dsUtil = new DataSourceUtil();
110
            DataSourceUtil dsUtil = new DataSourceUtil();
110
            dsUtil.setDataSource(dataSource, pageContext);
111
            dsUtil.setDataSource(dataSource, pageContext);
111
            ds = (DataSourceWrapper) dsUtil.getDataSource();
112
            ds = (DataSource) dsUtil.getDataSource();
112
        }
113
        }
113
        else {
114
        else {
114
            ds = new DataSourceWrapper();
115
            DataSourceWrapper dsw = new DataSourceWrapper();
115
            try {
116
            try {
116
                // set driver class iff provided by the tag
117
                // set driver class iff provided by the tag
117
                if (driverClassName != null) {
118
                if (driverClassName != null) {
118
                    ds.setDriverClassName(driverClassName);
119
                    dsw.setDriverClassName(driverClassName);
119
                }
120
                }
120
            }
121
            }
121
            catch (Exception e) {
122
            catch (Exception e) {
122
                throw new JspTagException(
123
                throw new JspTagException(
123
                    Resources.getMessage("DRIVER_INVALID_CLASS", e.getMessage()));
124
                    Resources.getMessage("DRIVER_INVALID_CLASS", e.getMessage()));
124
            }
125
            }
125
            ds.setJdbcURL(jdbcURL);
126
            dsw.setJdbcURL(jdbcURL);
126
            ds.setUserName(userName);
127
            dsw.setUserName(userName);
127
            ds.setPassword(password);
128
            dsw.setPassword(password);
129
            ds = (DataSource) dsw; 
128
        }
130
        }
129
131
130
        if (var != null) {
132
        if (var != null) {

Return to bug 8283