https://issues.apache.org/bugzilla/show_bug.cgi?id=52767
Bug #: 52767
Summary: Potential Bug or Inconsistency in JDBCRealm.java and
JDBCAccessLogValve.java
Product: Tomcat 7
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
This is Ken Cheung, a Computer Science M.Phil. student. I observed some
code clones in Tomcat and found inconsistent code:
/tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
676 if (driver == null) {
677 try {
678 Class<?> clazz = Class.forName(driverName);
679 driver = (Driver) clazz.newInstance();
680 } catch (Throwable e) {
681 ExceptionUtils.handleThrowable(e);
682 throw new SQLException(e.getMessage(), e);
683 }
684 }
685
686 // Open a new connection
687 Properties props = new Properties();
688 if (connectionName != null)
689 props.put("user", connectionName);
690 if (connectionPassword != null)
691 props.put("password", connectionPassword);
692 dbConnection = driver.connect(connectionURL, props);
/tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
566 if (driver == null) {
567 try {
568 Class<?> clazz = Class.forName(driverName);
569 driver = (Driver) clazz.newInstance();
570 } catch (Throwable e) {
571 ExceptionUtils.handleThrowable(e);
572 throw new SQLException(e.getMessage(), e);
573 }
574 }
575
576 // Open a new connection
577 Properties props = new Properties();
578 props.put("autoReconnect", "true");
579 if (connectionName != null) {
580 props.put("user", connectionName);
581 }
582 if (connectionPassword != null) {
583 props.put("password", connectionPassword);
584 }
585 conn = driver.connect(connectionURL, props);
Quick description of the inconsistency
Two code snippets are very similar code, but as you see, in JDBCRealm.java does
not use "props.put("autoReconnect", "true")" while JDBCAccessLogValve.java has.
We thought it could be a potential bug or inconsistency. Hope this helps.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]