Skip to content
Permalink
Browse files

some fixbugs cleanup (#1486)

  • Loading branch information...
davecramer committed May 28, 2019
1 parent 95ba7b2 commit 8bd9062f1c3dd1c80d096ff8db738dce010f8b46
@@ -423,8 +423,7 @@ public String receiveString() throws IOException {
* @throws IOException if a data I/O error occurs
*/
public byte[][] receiveTupleV3() throws IOException, OutOfMemoryError {
// TODO: use msgSize
int msgSize = receiveInteger4();
receiveInteger4(); // MESSAGE SIZE
int nf = receiveInteger2();
byte[][] answer = new byte[nf][];

@@ -2413,7 +2413,7 @@ public void handleCommandStatus(String status, int updateCount, long insertOID)
* Receive the field descriptions from the back end.
*/
private Field[] receiveFields() throws IOException {
int msgSize = pgStream.receiveInteger4();
pgStream.receiveInteger4(); // MESSAGE SIZE
int size = pgStream.receiveInteger2();
Field[] fields = new Field[size];

@@ -2440,7 +2440,7 @@ public void handleCommandStatus(String status, int updateCount, long insertOID)
}

private void receiveAsyncNotify() throws IOException {
int msglen = pgStream.receiveInteger4();
pgStream.receiveInteger4(); // MESSAGE SIZE
int pid = pgStream.receiveInteger4();
String msg = pgStream.receiveString();
String param = pgStream.receiveString();
@@ -2611,7 +2611,7 @@ public void readStartupMessages() throws IOException, SQLException {

public void receiveParameterStatus() throws IOException, SQLException {
// ParameterStatus
int len = pgStream.receiveInteger4();
pgStream.receiveInteger4(); // MESSAGE SIZE
String name = pgStream.receiveString();
String value = pgStream.receiveString();

@@ -60,8 +60,9 @@ public static Method getFunction(String functionName) {
if (method != null) {
return method;
}
//FIXME: this probably should not use the US locale
String nameLower = functionName.toLowerCase(Locale.US);
if (nameLower == functionName) {
if (nameLower.equals(functionName)) {
// Input name was in lower case, the function is not there
return null;
}
@@ -906,14 +906,18 @@ public String toString() {

final PrimitiveArraySupport arraySupport = PrimitiveArraySupport.getArraySupport(array);
if (arraySupport != null) {
fieldString = arraySupport.toArrayString(connection.getTypeInfo().getArrayDelimiter(oid), array);
fieldString =
arraySupport.toArrayString(connection.getTypeInfo().getArrayDelimiter(oid), array);
} else {
java.sql.Array tmpArray = connection.createArrayOf(getBaseTypeName(), (Object[]) array);
fieldString = tmpArray.toString();
}
} catch (SQLException e) {
fieldString = "NULL"; // punt
}
} else {
// avoid returning null
fieldString = "NULL";
}
return fieldString;
}
@@ -511,7 +511,7 @@ public synchronized Time toTime(Calendar cal, String s) throws SQLException {
}

// 2) Truncate date part so in given time zone the date would be formatted as 01/01/1970
return convertToTime(timeMillis, useCal == null ? null : useCal.getTimeZone());
return convertToTime(timeMillis, useCal.getTimeZone());
}

public synchronized Date toDate(Calendar cal, String s) throws SQLException {
@@ -1362,7 +1362,7 @@ private static long toPgSecs(long secs) {
int years = (int) ((secs + 15773356800L) / -3155823050L);
years++;
years -= years / 4;
secs += years * 86400;
secs += years * 86400L;
}
}

@@ -132,11 +132,6 @@ public LargeObjectManager(BaseConnection conn) throws SQLException {
Statement stmt = conn.createStatement();
ResultSet res = stmt.executeQuery(sql);

if (res == null) { // NOSONAR
throw new PSQLException(GT.tr("Failed to initialize LargeObject API"),
PSQLState.SYSTEM_ERROR);
}

fp.addFunctions(res);
res.close();
stmt.close();
@@ -142,7 +142,7 @@ public SingleCertValidatingFactory(String sslFactoryArg) throws GeneralSecurityE
}
}

public class SingleCertTrustManager implements X509TrustManager {
public static class SingleCertTrustManager implements X509TrustManager {
X509Certificate cert;
X509TrustManager trustManager;

0 comments on commit 8bd9062

Please sign in to comment.
You can’t perform that action at this time.