amyroh 2002/08/16 13:17:07 Modified: webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources SaveDataSourceAction.java SetUpDataSourceAction.java Log: Change to look for "username" attribute insted of "user" in JNDI datasource since DBCP no longer supports the "user" attribute. Fix for bugzilla 11775. Revision Changes Path 1.7 +17 -17 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SaveDataSourceAction.java Index: SaveDataSourceAction.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SaveDataSourceAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- SaveDataSourceAction.java 14 Jun 2002 13:29:29 -0000 1.6 +++ SaveDataSourceAction.java 16 Aug 2002 20:17:07 -0000 1.7 @@ -176,26 +176,26 @@ Object params[] = new Object[2]; params[0] = dataSourceForm.getJndiName(); - params[1] = ResourceUtils.DATASOURCE_CLASS; - + params[1] = ResourceUtils.DATASOURCE_CLASS; + String resourcetype = dataSourceForm.getResourcetype(); String path = dataSourceForm.getPath(); String host = dataSourceForm.getHost(); String service = dataSourceForm.getService(); - + ObjectName oname = null; try { if (resourcetype!=null) { // Construct the MBean Name for the naming source if (resourcetype.equals("Global")) { - oname = + oname = new ObjectName(ResourceUtils.NAMINGRESOURCES_TYPE + ResourceUtils.GLOBAL_TYPE); - } else if (resourcetype.equals("Context")) { - oname = - new ObjectName (ResourceUtils.NAMINGRESOURCES_TYPE + - ResourceUtils.CONTEXT_TYPE + ",path=" + path + + } else if (resourcetype.equals("Context")) { + oname = + new ObjectName (ResourceUtils.NAMINGRESOURCES_TYPE + + ResourceUtils.CONTEXT_TYPE + ",path=" + path + ",host=" + host + ",service=" + service); } else if (resourcetype.equals("DefaultContext")) { // add defaultcontext support later @@ -205,7 +205,7 @@ // Create the new object and associated MBean objectName = (String) mserver.invoke(oname, "addResource", params, signature); - + } catch (Exception e) { getServlet().log @@ -219,11 +219,11 @@ } } - + // Perform an "Update User database" transaction String attribute = null; try { - + ObjectName oname = new ObjectName(objectName); attribute = "url"; @@ -234,7 +234,7 @@ mserver.setAttribute (oname, new Attribute(attribute, dataSourceForm.getDriverClass())); - attribute = "user"; + attribute = "username"; mserver.setAttribute (oname, new Attribute(attribute, dataSourceForm.getUsername())); @@ -271,7 +271,7 @@ return (null); } - + // Proceed to the list entries screen return (mapping.findForward("DataSources List Setup")); 1.10 +15 -15 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SetUpDataSourceAction.java Index: SetUpDataSourceAction.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SetUpDataSourceAction.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- SetUpDataSourceAction.java 20 Jun 2002 02:31:06 -0000 1.9 +++ SetUpDataSourceAction.java 16 Aug 2002 20:17:07 -0000 1.10 @@ -115,7 +115,7 @@ * The MessageResources we will be retrieving messages from. */ private MessageResources resources = null; - + // --------------------------------------------------------- Public Methods @@ -156,8 +156,8 @@ String path = request.getParameter("path"); String host = request.getParameter("host"); String service = request.getParameter("service"); - - DataSourceForm dataSourceForm = new DataSourceForm(); + + DataSourceForm dataSourceForm = new DataSourceForm(); dataSourceForm.setResourcetype(resourcetype); dataSourceForm.setPath(path); dataSourceForm.setHost(host); @@ -172,12 +172,12 @@ dataSourceForm.setIdle("2"); dataSourceForm.setWait("5000"); dataSourceForm.setType(ResourceUtils.DATASOURCE_CLASS); - + } else { dataSourceForm.setNodeLabel (resources.getMessage(locale, "resources.actions.datasrc.edit")); dataSourceForm.setObjectName(objectName); - + String attribute = null; try { ObjectName oname = new ObjectName(objectName); @@ -190,7 +190,7 @@ attribute = "driverClassName"; dataSourceForm.setDriverClass ((String) mserver.getAttribute(oname, attribute)); - attribute = "user"; + attribute = "username"; dataSourceForm.setUsername ((String) mserver.getAttribute(oname, attribute)); attribute = "password"; @@ -199,7 +199,7 @@ try { attribute = "maxActive"; dataSourceForm.setActive - ((String) mserver.getAttribute(oname, attribute)); + ((String) mserver.getAttribute(oname, attribute)); } catch (Exception e) { // if maxActive not defined, display default value dataSourceForm.setActive("4"); @@ -207,11 +207,11 @@ try { attribute = "maxIdle"; dataSourceForm.setIdle - ((String) mserver.getAttribute(oname, attribute)); + ((String) mserver.getAttribute(oname, attribute)); } catch (Exception e) { // if maxIdle not defined, display default value dataSourceForm.setIdle("2"); - } + } try { attribute = "maxWait"; dataSourceForm.setWait @@ -236,9 +236,9 @@ resources.getMessage (locale, "users.error.attribute.get", attribute)); return (null); - } + } } - + // Stash the form bean and forward to the display page saveToken(request); request.setAttribute("dataSourceForm", dataSourceForm);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>