You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2009/09/01 15:26:09 UTC
svn commit: r810024 - in
/db/derby/code/trunk/java/client/org/apache/derby/client: am/Utils.java
net/NetConnection.java net/NetConnectionRequest.java net/Request.java
Author: kristwaa
Date: Tue Sep 1 13:26:08 2009
New Revision: 810024
URL: http://svn.apache.org/viewvc?rev=810024&view=rev
Log:
DERBY-4367: Replace Utils.min and Utils.max in the client driver with standard methods in java.lang.Math.
Removed methods min and max in Utils, as they duplicate standard methods in
java.lang.Math. Replaced all invocations.
Patch file: derby-4367-1a-remove_min_max.diff
Modified:
db/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java?rev=810024&r1=810023&r2=810024&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java Tue Sep 1 13:26:08 2009
@@ -22,8 +22,6 @@
package org.apache.derby.client.am;
import java.sql.SQLException;
-import org.apache.derby.iapi.types.SQLBit;
-import org.apache.derby.shared.common.i18n.MessageUtil;
import org.apache.derby.shared.common.reference.MessageId;
// Self-contained utilities.
@@ -237,14 +235,6 @@
}
}
- public static int min(int i, int j) {
- return (i < j) ? i : j;
- }
-
- public static int max(int i, int j) {
- return (i < j) ? j : i;
- }
-
// latestException is assumed to be non-null, accumulatedExceptions can be null
public static SQLException accumulateSQLException(SQLException latestException,
SQLException accumulatedExceptions) {
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java?rev=810024&r1=810023&r2=810024&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java Tue Sep 1 13:26:08 2009
@@ -32,7 +32,6 @@
import org.apache.derby.shared.common.reference.MessageId;
import org.apache.derby.shared.common.i18n.MessageUtil;
import org.apache.derby.client.am.Statement;
-import org.apache.derby.client.am.Utils;
import org.apache.derby.iapi.reference.Attribute;
import org.apache.derby.jdbc.ClientBaseDataSource;
import org.apache.derby.jdbc.ClientDriver;
@@ -1325,7 +1324,7 @@
prddtaLen,
netAgent_);
- int extnamTruncateLength = Utils.min(extnam_.length(), NetConfiguration.PRDDTA_APPL_ID_FIXED_LEN);
+ int extnamTruncateLength = Math.min(extnam_.length(), NetConfiguration.PRDDTA_APPL_ID_FIXED_LEN);
netAgent_.sourceCcsidManager_.convertFromUCS2(extnam_.substring(0, extnamTruncateLength),
prddta_,
prddtaLen,
@@ -1333,7 +1332,7 @@
prddtaLen += NetConfiguration.PRDDTA_APPL_ID_FIXED_LEN;
if (user_ != null) {
- int userTruncateLength = Utils.min(user_.length(), NetConfiguration.PRDDTA_USER_ID_FIXED_LEN);
+ int userTruncateLength = Math.min(user_.length(), NetConfiguration.PRDDTA_USER_ID_FIXED_LEN);
netAgent_.sourceCcsidManager_.convertFromUCS2(user_.substring(0, userTruncateLength),
prddta_,
prddtaLen,
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java?rev=810024&r1=810023&r2=810024&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java Tue Sep 1 13:26:08 2009
@@ -26,7 +26,6 @@
import org.apache.derby.client.am.SqlException;
import org.apache.derby.client.am.ClientMessageId;
-import org.apache.derby.client.am.Utils;
import org.apache.derby.shared.common.reference.SQLState;
public class NetConnectionRequest extends Request implements ConnectionRequestInterface {
@@ -431,7 +430,7 @@
// The External Name is the name of the job, task, or process on a
// system for which a DDM server is active.
private void buildEXTNAM(String extnam) throws SqlException {
- int extnamTruncateLength = Utils.min(extnam.length(),
+ int extnamTruncateLength = Math.min(extnam.length(),
NetConfiguration.EXTNAM_MAXSIZE);
writeScalarString(CodePoint.EXTNAM,
@@ -440,7 +439,7 @@
// Server Name is the name of the DDM server.
private void buildSRVNAM(String srvnam) throws SqlException {
- int srvnamTruncateLength = Utils.min(srvnam.length(),
+ int srvnamTruncateLength = Math.min(srvnam.length(),
NetConfiguration.SRVNAM_MAXSIZE);
writeScalarString(CodePoint.SRVNAM,
srvnam.substring(0, srvnamTruncateLength));
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java?rev=810024&r1=810023&r2=810024&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java Tue Sep 1 13:26:08 2009
@@ -21,10 +21,8 @@
package org.apache.derby.client.net;
import org.apache.derby.client.am.DisconnectException;
-import org.apache.derby.client.am.EncryptionManager;
import org.apache.derby.client.am.ClientMessageId;
import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.am.Utils;
import org.apache.derby.shared.common.reference.SQLState;
import java.io.BufferedInputStream;
@@ -294,9 +292,9 @@
int bytesToRead;
if (writeNullByte) {
- bytesToRead = Utils.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - 1 - extendedLengthByteCount);
+ bytesToRead = Math.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - 1 - extendedLengthByteCount);
} else {
- bytesToRead = Utils.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - extendedLengthByteCount);
+ bytesToRead = Math.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - extendedLengthByteCount);
}
byte[] lengthAndCodepoint;
@@ -455,9 +453,9 @@
int bytesToRead;
if (writeNullByte) {
- bytesToRead = Utils.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - 1 - extendedLengthByteCount);
+ bytesToRead = Math.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - 1 - extendedLengthByteCount);
} else {
- bytesToRead = Utils.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - extendedLengthByteCount);
+ bytesToRead = Math.min(leftToRead, DssConstants.MAX_DSS_LEN - 6 - 4 - extendedLengthByteCount);
}
buildLengthAndCodePointForLob(codePoint,
@@ -742,7 +740,7 @@
// either at end of data, end of dss segment, or both.
if (leftToRead != 0) {
// 32k segment filled and not at end of data.
- if ((Utils.min(2 + leftToRead, 32767)) > (bytes_.length - offset_)) {
+ if ((Math.min(2 + leftToRead, 32767)) > (bytes_.length - offset_)) {
try {
sendBytes(netAgent_.getOutputStream());
} catch (java.io.IOException ioe) {
@@ -752,7 +750,7 @@
dssLengthLocation_ = offset_;
bytes_[offset_++] = (byte) (0xff);
bytes_[offset_++] = (byte) (0xff);
- newBytesToRead = Utils.min(leftToRead, 32765);
+ newBytesToRead = Math.min(leftToRead, 32765);
}
return newBytesToRead;