commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject commons-dbcp git commit: [DBCP-495] Remove duplicate code in org.apache.commons.dbcp2.cpdsadapter.PStmtKeyCPDS.
Date Fri, 08 Jun 2018 22:19:19 GMT
Repository: commons-dbcp
Updated Branches:
  refs/heads/master 89d2eb8fa -> 661fb0c9c


[DBCP-495] Remove duplicate code in
org.apache.commons.dbcp2.cpdsadapter.PStmtKeyCPDS.

Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/661fb0c9
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/661fb0c9
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/661fb0c9

Branch: refs/heads/master
Commit: 661fb0c9c01c87410cdf1abda41d78906656c7e5
Parents: 89d2eb8
Author: Gary Gregory <garydgregory@gmail.com>
Authored: Fri Jun 8 16:19:16 2018 -0600
Committer: Gary Gregory <garydgregory@gmail.com>
Committed: Fri Jun 8 16:19:16 2018 -0600

----------------------------------------------------------------------
 src/changes/changes.xml                         |  3 +
 .../commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java | 91 +-------------------
 2 files changed, 5 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/661fb0c9/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f5eae35..c0c3271 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="update" issue="DBCP-494" due-to="Gary Gregory">
         org.apache.commons.dbcp2.PStmtKey should make copies of given arrays in constructors.
       </action>
+      <action dev="ggregory" type="update" issue="DBCP-495" due-to="Gary Gregory">
+        Remove duplicate code in org.apache.commons.dbcp2.cpdsadapter.PStmtKeyCPDS.
+      </action>
     </release>
     <release version="2.3.0" date="2018-05-12" description="This is a minor release, including
bug fixes and enhancements.">
       <action dev="pschumacher" type="fix" issue="DBCP-476" due-to="Gary Evesson, Richard
Cordova">

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/661fb0c9/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java
index c158925..e006f59 100644
--- a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java
+++ b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.dbcp2.cpdsadapter;
 
-import java.util.Arrays;
-
 import org.apache.commons.dbcp2.PStmtKey;
 
 /**
@@ -25,113 +23,28 @@ import org.apache.commons.dbcp2.PStmtKey;
  * @since 2.0
  */
 public class PStmtKeyCPDS extends PStmtKey {
-    private final Integer _resultSetHoldability;
-    private final int _columnIndexes[];
-    private final String _columnNames[];
-
     public PStmtKeyCPDS(final String sql) {
         super(sql);
-        _resultSetHoldability = null;
-        _columnIndexes = null;
-        _columnNames = null;
     }
 
     public PStmtKeyCPDS(final String sql, final int autoGeneratedKeys) {
         super(sql, null, autoGeneratedKeys);
-        _resultSetHoldability = null;
-        _columnIndexes = null;
-        _columnNames = null;
     }
 
     public PStmtKeyCPDS(final String sql, final int resultSetType, final int resultSetConcurrency)
{
         super(sql, resultSetType, resultSetConcurrency);
-        _resultSetHoldability = null;
-        _columnIndexes = null;
-        _columnNames = null;
     }
 
     public PStmtKeyCPDS(final String sql, final int resultSetType, final int resultSetConcurrency,
             final int resultSetHoldability) {
         super(sql, resultSetType, resultSetConcurrency);
-        _resultSetHoldability = Integer.valueOf(resultSetHoldability);
-        _columnIndexes = null;
-        _columnNames = null;
     }
 
     public PStmtKeyCPDS(final String sql, final int columnIndexes[]) {
-        super(sql);
-        _columnIndexes = Arrays.copyOf(columnIndexes, columnIndexes.length);
-        _resultSetHoldability = null;
-        _columnNames = null;
+        super(sql, null, columnIndexes);
     }
 
     public PStmtKeyCPDS(final String sql, final String columnNames[]) {
-        super(sql);
-        _columnNames = Arrays.copyOf(columnNames, columnNames.length);
-        _resultSetHoldability = null;
-        _columnIndexes = null;
-    }
-
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final PStmtKeyCPDS other = (PStmtKeyCPDS) obj;
-        if (!Arrays.equals(_columnIndexes, other._columnIndexes)) {
-            return false;
-        }
-        if (!Arrays.equals(_columnNames, other._columnNames)) {
-            return false;
-        }
-        if (_resultSetHoldability == null) {
-            if (other._resultSetHoldability != null) {
-                return false;
-            }
-        } else if (!_resultSetHoldability.equals(other._resultSetHoldability)) {
-            return false;
-        }
-        return true;
-    }
-
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + Arrays.hashCode(_columnIndexes);
-        result = prime * result + Arrays.hashCode(_columnNames);
-        result = prime * result + (_resultSetHoldability == null ? 0 : _resultSetHoldability.hashCode());
-        return result;
-    }
-
-
-    @Override
-    public String toString() {
-        final StringBuffer buf = new StringBuffer();
-        buf.append("PStmtKey: sql=");
-        buf.append(getSql());
-        buf.append(", catalog=");
-        buf.append(getCatalog());
-        buf.append(", resultSetType=");
-        buf.append(getResultSetType());
-        buf.append(", resultSetConcurrency=");
-        buf.append(getResultSetConcurrency());
-        buf.append(", statementType=");
-        buf.append(getStmtType());
-        buf.append(", resultSetHoldability=");
-        buf.append(_resultSetHoldability);
-        buf.append(", columnIndexes=");
-        buf.append(Arrays.toString(_columnIndexes));
-        buf.append(", columnNames=");
-        buf.append(Arrays.toString(_columnNames));
-        return buf.toString();
+        super(sql, null, columnNames);
     }
 }


Mime
View raw message