You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/06/13 17:28:48 UTC

[26/50] [abbrv] commons-dbcp git commit: Javadoc, better param names, line length 120.

Javadoc, better param names, line length 120.

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

Branch: refs/heads/release
Commit: 6aa057ff95f0c14a7fcb562020d71bde571c2e87
Parents: f20a569
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Jun 11 18:12:19 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Jun 11 18:12:19 2018 -0600

----------------------------------------------------------------------
 .../java/org/apache/commons/dbcp2/Utils.java    | 70 ++++++++++++--------
 1 file changed, 41 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/6aa057ff/src/main/java/org/apache/commons/dbcp2/Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index 80c80ea..059f3d9 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -28,15 +28,18 @@ import java.util.Set;
 
 /**
  * Utility methods.
+ * 
  * @since 2.0
  */
 public final class Utils {
 
-    private static final ResourceBundle messages = ResourceBundle.getBundle(
-            Utils.class.getPackage().getName() + ".LocalStrings");
+    private static final ResourceBundle messages = ResourceBundle
+            .getBundle(Utils.class.getPackage().getName() + ".LocalStrings");
 
-    public static final boolean IS_SECURITY_ENABLED =
-            System.getSecurityManager() != null;
+    /**
+     * Whether the security manager is enabled.
+     */
+    public static final boolean IS_SECURITY_ENABLED = System.getSecurityManager() != null;
 
     /** Any SQL_STATE starting with this value is considered a fatal disconnect */
     public static final String DISCONNECTION_SQL_CODE_PREFIX = "08";
@@ -44,12 +47,12 @@ public final class Utils {
     /**
      * SQL codes of fatal connection errors.
      * <ul>
-     *  <li>57P01 (ADMIN SHUTDOWN)</li>
-     *  <li>57P02 (CRASH SHUTDOWN)</li>
-     *  <li>57P03 (CANNOT CONNECT NOW)</li>
-     *  <li>01002 (SQL92 disconnect error)</li>
-     *  <li>JZ0C0 (Sybase disconnect error)</li>
-     *  <li>JZ0C1 (Sybase disconnect error)</li>
+     * <li>57P01 (ADMIN SHUTDOWN)</li>
+     * <li>57P02 (CRASH SHUTDOWN)</li>
+     * <li>57P03 (CANNOT CONNECT NOW)</li>
+     * <li>01002 (SQL92 disconnect error)</li>
+     * <li>JZ0C0 (Sybase disconnect error)</li>
+     * <li>JZ0C1 (Sybase disconnect error)</li>
      * </ul>
      */
     public static final Set<String> DISCONNECTION_SQL_CODES;
@@ -71,12 +74,13 @@ public final class Utils {
     /**
      * Closes the ResultSet (which may be null).
      *
-     * @param rset a ResultSet, may be {@code null}
+     * @param resultSet
+     *            a ResultSet, may be {@code null}
      */
-    public static void closeQuietly(final ResultSet rset) {
-        if (rset != null) {
+    public static void closeQuietly(final ResultSet resultSet) {
+        if (resultSet != null) {
             try {
-                rset.close();
+                resultSet.close();
             } catch (final Exception e) {
                 // ignored
             }
@@ -86,12 +90,13 @@ public final class Utils {
     /**
      * Closes the Connection (which may be null).
      *
-     * @param conn a Connection, may be {@code null}
+     * @param connection
+     *            a Connection, may be {@code null}
      */
-    public static void closeQuietly(final Connection conn) {
-        if (conn != null) {
+    public static void closeQuietly(final Connection connection) {
+        if (connection != null) {
             try {
-                conn.close();
+                connection.close();
             } catch (final Exception e) {
                 // ignored
             }
@@ -101,33 +106,41 @@ public final class Utils {
     /**
      * Closes the Statement (which may be null).
      *
-     * @param stmt a Statement, may be {@code null}
+     * @param statement
+     *            a Statement, may be {@code null}.
      */
-    public static void closeQuietly(final Statement stmt) {
-        if (stmt != null) {
+    public static void closeQuietly(final Statement statement) {
+        if (statement != null) {
             try {
-                stmt.close();
+                statement.close();
             } catch (final Exception e) {
                 // ignored
             }
         }
     }
 
-
     /**
-     * Obtain the correct i18n message for the given key.
+     * Gets the correct i18n message for the given key.
+     * 
+     * @param key
+     *            The key to look up an i18n message.
+     * @return The i18n message.
      */
     public static String getMessage(final String key) {
         return getMessage(key, (Object[]) null);
     }
 
-
     /**
-     * Obtain the correct i18n message for the given key with placeholders
-     * replaced by the supplied arguments.
+     * Gets the correct i18n message for the given key with placeholders replaced by the supplied arguments.
+     * 
+     * @param key
+     *            A message key.
+     * @param args
+     *            The message arguments.
+     * @return An i18n message.
      */
     public static String getMessage(final String key, final Object... args) {
-        final String msg =  messages.getString(key);
+        final String msg = messages.getString(key);
         if (args == null || args.length == 0) {
             return msg;
         }
@@ -146,7 +159,6 @@ public final class Utils {
         return value != null ? value.toCharArray() : null;
     }
 
-
     /**
      * Converts the given char[] to a String.
      *