Permalink
Browse files

style: code cleanup and Java 5' features

  • Loading branch information...
AlexElin authored and vlsi committed Jul 6, 2016
1 parent af50d0b commit 8e8dbab04a72813e71b28c74a74513d795979e6a
Showing with 179 additions and 203 deletions.
  1. +3 −7 pgjdbc/src/main/java/org/postgresql/Driver.java
  2. +13 −13 pgjdbc/src/main/java/org/postgresql/PGConnection.java
  3. +3 −3 pgjdbc/src/main/java/org/postgresql/PGNotification.java
  4. +1 −1 pgjdbc/src/main/java/org/postgresql/PGRefCursorResultSet.java
  5. +4 −4 pgjdbc/src/main/java/org/postgresql/PGResultSetMetaData.java
  6. +9 −9 pgjdbc/src/main/java/org/postgresql/PGStatement.java
  7. +1 −1 pgjdbc/src/main/java/org/postgresql/copy/CopyIn.java
  8. +1 −1 pgjdbc/src/main/java/org/postgresql/copy/CopyOperation.java
  9. +26 −26 pgjdbc/src/main/java/org/postgresql/core/BaseConnection.java
  10. +4 −4 pgjdbc/src/main/java/org/postgresql/core/BaseStatement.java
  11. +1 −1 pgjdbc/src/main/java/org/postgresql/core/ParameterList.java
  12. +8 −8 pgjdbc/src/main/java/org/postgresql/core/ProtocolConnection.java
  13. +10 −10 pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java
  14. +20 −20 pgjdbc/src/main/java/org/postgresql/core/TypeInfo.java
  15. +3 −3 pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java
  16. +1 −1 pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java
  17. +2 −3 pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java
  18. +3 −10 pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
  19. +5 −5 pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java
  20. +4 −4 pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java
  21. +30 −30 pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
  22. +16 −19 pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
  23. +2 −2 pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java
  24. +2 −6 pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java
  25. +3 −4 pgjdbc/src/main/java/org/postgresql/util/ObjectFactory.java
  26. +3 −3 pgjdbc/src/main/java/org/postgresql/util/PGBinaryObject.java
  27. +1 −5 pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java
@@ -417,10 +417,7 @@ private static Connection makeConnection(String url, Properties props) throws SQ
* @see java.sql.Driver#acceptsURL
*/
public boolean acceptsURL(String url) {
if (parseURL(url, null) == null) {
return false;
}
return true;
return parseURL(url, null) != null;
}
/**
@@ -567,9 +564,8 @@ public static Properties parseURL(String url, Properties defaults) {
// parse the args part of the url
String[] args = l_urlArgs.split("&");
for (int i = 0; i < args.length; ++i) {
String token = args[i];
if (token.length() == 0) {
for (String token : args) {
if (token.isEmpty()) {
continue;
}
int l_pos = token.indexOf('=');
@@ -29,7 +29,7 @@
* @throws SQLException if something wrong happens
* @since 7.3
*/
public PGNotification[] getNotifications() throws SQLException;
PGNotification[] getNotifications() throws SQLException;
/**
* This returns the COPY API for the current connection.
@@ -38,7 +38,7 @@
* @throws SQLException if something wrong happens
* @since 8.4
*/
public CopyManager getCopyAPI() throws SQLException;
CopyManager getCopyAPI() throws SQLException;
/**
* This returns the LargeObject API for the current connection.
@@ -47,7 +47,7 @@
* @throws SQLException if something wrong happens
* @since 7.3
*/
public LargeObjectManager getLargeObjectAPI() throws SQLException;
LargeObjectManager getLargeObjectAPI() throws SQLException;
/**
* This returns the Fastpath API for the current connection.
@@ -56,7 +56,7 @@
* @throws SQLException if something wrong happens
* @since 7.3
*/
public Fastpath getFastpathAPI() throws SQLException;
Fastpath getFastpathAPI() throws SQLException;
/**
* This allows client code to add a handler for one of org.postgresql's more unique data types. It
@@ -69,7 +69,7 @@
* does not work correctly for registering classes that cannot be directly loaded by
* the JDBC driver's classloader.
*/
public void addDataType(String type, String className);
void addDataType(String type, String className);
/**
* This allows client code to add a handler for one of org.postgresql's more unique data types.
@@ -100,7 +100,7 @@
* @see org.postgresql.util.PGobject
* @since 8.0
*/
public void addDataType(String type, Class<? extends PGobject> klass) throws SQLException;
void addDataType(String type, Class<? extends PGobject> klass) throws SQLException;
/**
* Set the default statement reuse threshold before enabling server-side prepare. See
@@ -109,7 +109,7 @@
* @param threshold the new threshold
* @since build 302
*/
public void setPrepareThreshold(int threshold);
void setPrepareThreshold(int threshold);
/**
* Get the default server-side prepare reuse threshold for statements created from this
@@ -118,7 +118,7 @@
* @return the current threshold
* @since build 302
*/
public int getPrepareThreshold();
int getPrepareThreshold();
/**
* Set the default fetch size for statements created from this connection
@@ -127,7 +127,7 @@
* @throws SQLException if specified negative <code>fetchSize</code> parameter
* @see Statement#setFetchSize(int)
*/
public void setDefaultFetchSize(int fetchSize) throws SQLException;
void setDefaultFetchSize(int fetchSize) throws SQLException;
/**
@@ -137,14 +137,14 @@
* @see PGProperty#DEFAULT_ROW_FETCH_SIZE
* @see Statement#getFetchSize()
*/
public int getDefaultFetchSize();
int getDefaultFetchSize();
/**
* Return the process ID (PID) of the backend server process handling this connection.
*
* @return PID of backend server process.
*/
public int getBackendPID();
int getBackendPID();
/**
* Return the given string suitably quoted to be used as an identifier in an SQL statement string.
@@ -155,7 +155,7 @@
* @return the escaped identifier
* @throws SQLException if something goes wrong
*/
public String escapeIdentifier(String identifier) throws SQLException;
String escapeIdentifier(String identifier) throws SQLException;
/**
* Return the given string suitably quoted to be used as a string literal in an SQL statement
@@ -166,5 +166,5 @@
* @return the quoted literal
* @throws SQLException if something goes wrong
*/
public String escapeLiteral(String literal) throws SQLException;
String escapeLiteral(String literal) throws SQLException;
}
@@ -18,15 +18,15 @@
* @return name of this notification
* @since 7.3
*/
public String getName();
String getName();
/**
* Returns the process id of the backend process making this notification
*
* @return process id of the backend process making this notification
* @since 7.3
*/
public int getPID();
int getPID();
/**
* Returns additional information from the notifying process. This feature has only been
@@ -36,5 +36,5 @@
* @return additional information from the notifying process
* @since 8.0
*/
public String getParameter();
String getParameter();
}
@@ -22,5 +22,5 @@
* @deprecated As of 8.0, replaced with calling getString() on the ResultSet that this ResultSet
* was obtained from.
*/
public String getRefCursor();
String getRefCursor();
}
@@ -22,7 +22,7 @@
* @throws SQLException if something wrong happens
* @since 8.0
*/
public String getBaseColumnName(int column) throws SQLException;
String getBaseColumnName(int column) throws SQLException;
/**
* Returns the underlying table name of query result, or "" if it is unable to be determined.
@@ -32,7 +32,7 @@
* @throws SQLException if something wrong happens
* @since 8.0
*/
public String getBaseTableName(int column) throws SQLException;
String getBaseTableName(int column) throws SQLException;
/**
* Returns the underlying schema name of query result, or "" if it is unable to be determined.
@@ -42,7 +42,7 @@
* @throws SQLException if something wrong happens
* @since 8.0
*/
public String getBaseSchemaName(int column) throws SQLException;
String getBaseSchemaName(int column) throws SQLException;
/**
* Is a column Text or Binary?
@@ -54,5 +54,5 @@
* @see Field#TEXT_FORMAT
* @since 9.4
*/
public int getFormat(int column) throws SQLException;
int getFormat(int column) throws SQLException;
}
@@ -21,10 +21,10 @@
// The follow values are the nearest MAX/MIN values with hour,
// minute, second, millisecond set to 0 - this is used for
// -infinity / infinity representation in Java
public static final long DATE_POSITIVE_INFINITY = 9223372036825200000L;
public static final long DATE_NEGATIVE_INFINITY = -9223372036832400000L;
public static final long DATE_POSITIVE_SMALLER_INFINITY = 185543533774800000L;
public static final long DATE_NEGATIVE_SMALLER_INFINITY = -185543533774800000L;
long DATE_POSITIVE_INFINITY = 9223372036825200000L;
long DATE_NEGATIVE_INFINITY = -9223372036832400000L;
long DATE_POSITIVE_SMALLER_INFINITY = 185543533774800000L;
long DATE_NEGATIVE_SMALLER_INFINITY = -185543533774800000L;
/**
@@ -34,7 +34,7 @@
* @throws SQLException if something goes wrong
* @since 7.3
*/
public long getLastOID() throws SQLException;
long getLastOID() throws SQLException;
/**
* Turn on the use of prepared statements in the server (server side prepared statements are
@@ -46,7 +46,7 @@
* @since 7.3
* @deprecated As of build 302, replaced by {@link #setPrepareThreshold(int)}
*/
public void setUseServerPrepare(boolean flag) throws SQLException;
void setUseServerPrepare(boolean flag) throws SQLException;
/**
* Checks if this statement will be executed as a server-prepared statement. A return value of
@@ -55,7 +55,7 @@
*
* @return true if the next reuse of this statement will use a server-prepared statement
*/
public boolean isUseServerPrepare();
boolean isUseServerPrepare();
/**
* Sets the reuse threshold for using server-prepared statements.
@@ -72,7 +72,7 @@
* @throws SQLException if an exception occurs while changing the threshold
* @since build 302
*/
public void setPrepareThreshold(int threshold) throws SQLException;
void setPrepareThreshold(int threshold) throws SQLException;
/**
* Gets the server-side prepare reuse threshold in use for this statement.
@@ -81,5 +81,5 @@
* @see #setPrepareThreshold(int)
* @since build 302
*/
public int getPrepareThreshold();
int getPrepareThreshold();
}
@@ -41,5 +41,5 @@
* @return number of updated rows for server 8.2 or newer (see getHandledRowCount())
* @throws SQLException if the operation fails.
*/
public long endCopy() throws SQLException;
long endCopy() throws SQLException;
}
@@ -50,5 +50,5 @@
*
* @return number of handled rows or -1
*/
public long getHandledRowCount();
long getHandledRowCount();
}
Oops, something went wrong.

0 comments on commit 8e8dbab

Please sign in to comment.