You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ca...@apache.org on 2005/07/22 02:27:25 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/db ConnectionSourceSkeleton.java DataSourceConnectionSource.java DriverManagerConnectionSource.java JNDIConnectionSource.java

carnold     2005/07/21 17:27:25

  Modified:    src/java/org/apache/log4j/db ConnectionSourceSkeleton.java
                        DataSourceConnectionSource.java
                        DriverManagerConnectionSource.java
                        JNDIConnectionSource.java
  Log:
  Bug 33827: Conflicting definitions of dialectCode in JNDIConnectionSource
  
  Revision  Changes    Path
  1.11      +12 -12    logging-log4j/src/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
  
  Index: ConnectionSourceSkeleton.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/ConnectionSourceSkeleton.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ConnectionSourceSkeleton.java	6 Jan 2005 17:03:10 -0000	1.10
  +++ ConnectionSourceSkeleton.java	22 Jul 2005 00:27:25 -0000	1.11
  @@ -28,13 +28,13 @@
    * @author Ceki Gülcü
    */
   public abstract class ConnectionSourceSkeleton extends ComponentBase implements ConnectionSource {
  -  protected String user = null;
  -  protected String password = null;
  +  private String user = null;
  +  private String password = null;
   
     // initially we have an unkonw dialect
  -  protected int dialectCode = UNKNOWN_DIALECT;
  -  protected boolean supportsGetGeneratedKeys = false;
  -  protected boolean supportsBatchUpdates = false;
  +  private int dialectCode = UNKNOWN_DIALECT;
  +  private boolean supportsGetGeneratedKeys = false;
  +  private boolean supportsBatchUpdates = false;
   
   
     /**
  @@ -62,18 +62,18 @@
     /**
      * Does this connection support the JDBC Connection.getGeneratedKeys method?
      */
  -  public boolean supportsGetGeneratedKeys() {
  +  public final boolean supportsGetGeneratedKeys() {
       return supportsGetGeneratedKeys;
     }
   
  -  public int getSQLDialectCode() {
  +  public final int getSQLDialectCode() {
       return dialectCode;
     }
   
     /**
      * Get the password for this connection source.
      */
  -  public String getPassword() {
  +  public final String getPassword() {
       return password;
     }
   
  @@ -81,14 +81,14 @@
      * Sets the password.
      * @param password The password to set
      */
  -  public void setPassword(String password) {
  +  public final void setPassword(final String password) {
       this.password = password;
     }
   
     /**
      * Get the user for this connection source.
      */
  -  public String getUser() {
  +  public final String getUser() {
       return user;
     }
   
  @@ -96,14 +96,14 @@
      * Sets the username.
      * @param username The username to set
      */
  -  public void setUser(String username) {
  +  public final void setUser(final String username) {
       this.user = username;
     }
   
     /**
      * Does this connection support batch updates?
      */
  -  public boolean supportsBatchUpdates() {
  +  public final boolean supportsBatchUpdates() {
       return supportsBatchUpdates;
     }
   }
  
  
  
  1.10      +3 -3      logging-log4j/src/java/org/apache/log4j/db/DataSourceConnectionSource.java
  
  Index: DataSourceConnectionSource.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/DataSourceConnectionSource.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DataSourceConnectionSource.java	6 Jan 2005 17:03:10 -0000	1.9
  +++ DataSourceConnectionSource.java	22 Jul 2005 00:27:25 -0000	1.10
  @@ -51,7 +51,7 @@
         if(connection != null) {
           discoverConnnectionProperties();
         } 
  -      if(!supportsGetGeneratedKeys && dialectCode == ConnectionSource.UNKNOWN_DIALECT) {
  +      if(!supportsGetGeneratedKeys() && getSQLDialectCode() == ConnectionSource.UNKNOWN_DIALECT) {
           getLogger().warn("Connection does not support GetGeneratedKey method and could not discover the dialect.");
         }
       }
  @@ -66,10 +66,10 @@
         return null;
       }
   
  -    if (user == null) {
  +    if (getUser() == null) {
         return dataSource.getConnection();
       } else {
  -      return dataSource.getConnection(user, password);
  +      return dataSource.getConnection(getUser(), getPassword());
       }
     }
   
  
  
  
  1.8       +3 -3      logging-log4j/src/java/org/apache/log4j/db/DriverManagerConnectionSource.java
  
  Index: DriverManagerConnectionSource.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/DriverManagerConnectionSource.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DriverManagerConnectionSource.java	6 Jan 2005 17:03:10 -0000	1.7
  +++ DriverManagerConnectionSource.java	22 Jul 2005 00:27:25 -0000	1.8
  @@ -66,7 +66,7 @@
    */
   public class DriverManagerConnectionSource extends ConnectionSourceSkeleton {
     private String driverClass = null;
  -  protected String url = null;
  +  private String url = null;
   
     public void activateOptions() {
       try {
  @@ -87,10 +87,10 @@
      * @see org.apache.log4j.db.ConnectionSource#getConnection()
      */
     public Connection getConnection() throws SQLException {
  -    if (user == null) {
  +    if (getUser() == null) {
         return DriverManager.getConnection(url);
       } else {
  -      return DriverManager.getConnection(url, user, password);
  +      return DriverManager.getConnection(url, getUser(), getPassword());
       }
     }
   
  
  
  
  1.10      +2 -16     logging-log4j/src/java/org/apache/log4j/db/JNDIConnectionSource.java
  
  Index: JNDIConnectionSource.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/JNDIConnectionSource.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JNDIConnectionSource.java	6 Jan 2005 17:03:10 -0000	1.9
  +++ JNDIConnectionSource.java	22 Jul 2005 00:27:25 -0000	1.10
  @@ -65,7 +65,6 @@
          extends ConnectionSourceSkeleton {
     private String jndiLocation = null;
     private DataSource dataSource = null;
  -  int dialectCode = ConnectionSource.UNKNOWN_DIALECT;
   
     /**
      * @see org.apache.log4j.spi.OptionHandler#activateOptions()
  @@ -90,10 +89,10 @@
         if(dataSource == null) {
           dataSource = lookupDataSource();
         }
  -      if (user == null) {
  +      if (getUser() == null) {
           conn = dataSource.getConnection();
         } else {
  -        conn = dataSource.getConnection(user, password);
  +        conn = dataSource.getConnection(getUser(), getPassword());
         }
       } catch (final NamingException ne) {
            getLogger().error("Error while getting data source", ne);
  @@ -124,19 +123,6 @@
     }
   
   
  -  /**
  -   * Sets the password.
  -   * @param password The password to set
  -   */
  -  public void setPassword(String password) {
  -    this.password = password;
  -  }
  -
  -
  -  public int getSQLDialectCode() {
  -    return dialectCode;
  -  }
  -  
     private DataSource lookupDataSource()
            throws NamingException, SQLException {
       DataSource ds;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org