commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject [2/2] commons-pool git commit: Fix checkstyle errors
Date Tue, 31 Oct 2017 07:45:08 GMT
Fix checkstyle errors


Project: http://git-wip-us.apache.org/repos/asf/commons-pool/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-pool/commit/09a4867e
Tree: http://git-wip-us.apache.org/repos/asf/commons-pool/tree/09a4867e
Diff: http://git-wip-us.apache.org/repos/asf/commons-pool/diff/09a4867e

Branch: refs/heads/master
Commit: 09a4867e45e22b2a704b936bd683f15855cfdbfb
Parents: 376c0d1
Author: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Authored: Sun Oct 29 23:28:55 2017 +1300
Committer: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Committed: Tue Oct 31 19:41:39 2017 +1300

----------------------------------------------------------------------
 .gitignore                                      |  2 ++
 checkstyle.xml                                  |  5 -----
 license-header.txt                              | 16 --------------
 pom.xml                                         | 13 +++++++++++
 .../org/apache/commons/pool2/PoolUtils.java     | 23 ++++++++++++++++++++
 .../commons/pool2/impl/CallStackUtils.java      | 11 ++++++++--
 .../commons/pool2/impl/EvictionTimer.java       |  3 +++
 .../pool2/impl/GenericKeyedObjectPool.java      |  2 ++
 .../commons/pool2/impl/LinkedBlockingDeque.java |  6 ++++-
 .../pool2/impl/SecurityManagerCallStack.java    | 22 +++++++++++++++++++
 .../commons/pool2/impl/ThrowableCallStack.java  |  9 ++++++++
 11 files changed, 88 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..084b44a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+target
+site-content

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 23240ad..e68b6bb 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -27,11 +27,6 @@
 
   <property name="localeLanguage" value="en"/>
 
-  <!-- Verify that EVERY source file has the appropriate license -->
-  <module name="Header">
-    <property name="headerFile" value="${checkstyle.header.file}"/>
-  </module>
-
   <!-- No tabs allowed! -->
   <module name="FileTabCharacter"/>
     

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/license-header.txt
----------------------------------------------------------------------
diff --git a/license-header.txt b/license-header.txt
deleted file mode 100644
index ae6f28c..0000000
--- a/license-header.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d0720a3..a415ce2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -268,6 +268,19 @@
         <artifactId>cobertura-maven-plugin</artifactId>
         <version>2.7</version>
       </plugin>
+      <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <exclude>src/test/resources/test1</exclude>
+              <exclude>src/test/resources/test2</exclude>
+              <exclude>.checkstyle</exclude>
+              <exclude>.fbprefs</exclude>
+              <exclude>.pmd</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
     </plugins>
   </reporting>
     

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/PoolUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/PoolUtils.java b/src/main/java/org/apache/commons/pool2/PoolUtils.java
index 9a863af..512d580 100644
--- a/src/main/java/org/apache/commons/pool2/PoolUtils.java
+++ b/src/main/java/org/apache/commons/pool2/PoolUtils.java
@@ -562,6 +562,8 @@ public final class PoolUtils {
      * Timer task that adds objects to the pool until the number of idle
      * instances reaches the configured minIdle. Note that this is not the same
      * as the pool's minIdle setting.
+     *
+     * @param <T> type of objects in the pool
      */
     private static final class ObjectPoolMinIdleTimerTask<T> extends TimerTask {
 
@@ -631,6 +633,9 @@ public final class PoolUtils {
      * Timer task that adds objects to the pool until the number of idle
      * instances for the given key reaches the configured minIdle. Note that
      * this is not the same as the pool's minIdle setting.
+     *
+     * @param <K> object pool key type
+     * @param <V> object pool value type
      */
     private static final class KeyedObjectPoolMinIdleTimerTask<K, V> extends
             TimerTask {
@@ -715,6 +720,8 @@ public final class PoolUtils {
      * another layer of synchronization will cause liveliness issues or a
      * deadlock.
      * </p>
+     *
+     * @param <T> type of objects in the pool
      */
     private static final class SynchronizedObjectPool<T> implements ObjectPool<T>
{
 
@@ -888,6 +895,9 @@ public final class PoolUtils {
      * another layer of synchronization will cause liveliness issues or a
      * deadlock.
      * </p>
+     *
+     * @param <K> object pool key type
+     * @param <V> object pool value type
      */
     private static final class SynchronizedKeyedObjectPool<K, V> implements
             KeyedObjectPool<K, V> {
@@ -1103,6 +1113,8 @@ public final class PoolUtils {
      * provide proper synchronization such as the pools provided in the Commons
      * Pool library.
      * </p>
+     *
+     * @param <T> pooled object factory type
      */
     private static final class SynchronizedPooledObjectFactory<T> implements
             PooledObjectFactory<T> {
@@ -1216,6 +1228,9 @@ public final class PoolUtils {
      * provide proper synchronization such as the pools provided in the Commons
      * Pool library.
      * </p>
+     *
+     * @param <K> pooled object factory key type
+     * @param <V> pooled object factory key value
      */
     private static final class SynchronizedKeyedPooledObjectFactory<K, V>
             implements KeyedPooledObjectFactory<K, V> {
@@ -1399,6 +1414,8 @@ public final class PoolUtils {
      * Decorates an object pool, adding "eroding" behavior. Based on the
      * configured {@link #factor erosion factor}, objects returning to the pool
      * may be invalidated instead of being added to idle capacity.
+     *
+     * @param <T> type of objects in the pool
      */
     private static class ErodingObjectPool<T> implements ObjectPool<T> {
         /** Underlying object pool */
@@ -1540,6 +1557,9 @@ public final class PoolUtils {
      * Decorates a keyed object pool, adding "eroding" behavior. Based on the
      * configured erosion factor, objects returning to the pool
      * may be invalidated instead of being added to idle capacity.
+     *
+     * @param <K> object pool key type
+     * @param <V> object pool value type
      */
     private static class ErodingKeyedObjectPool<K, V> implements
             KeyedObjectPool<K, V> {
@@ -1750,6 +1770,9 @@ public final class PoolUtils {
      * Extends ErodingKeyedObjectPool to allow erosion to take place on a
      * per-key basis. Timing of erosion events is tracked separately for
      * separate keyed pools.
+     *
+     * @param <K> object pool key type
+     * @param <V> object pool value type
      */
     private static final class ErodingPerKeyKeyedObjectPool<K, V> extends
             ErodingKeyedObjectPool<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java b/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
index 4271af0..fed4b3d 100644
--- a/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
+++ b/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
@@ -31,6 +31,10 @@ public final class CallStackUtils {
         CAN_CREATE_SECURITY_MANAGER = canCreateSecurityManager();
     }
 
+    /**
+     * @return {@code true} if it is able to create a security manager in the current environment,
{@code false}
+     *         otherwise.
+     */
     private static boolean canCreateSecurityManager() {
         final SecurityManager manager = System.getSecurityManager();
         if (manager == null) {
@@ -53,10 +57,13 @@ public final class CallStackUtils {
      * @return a new CallStack
      */
     public static CallStack newCallStack(final String messageFormat, final boolean useTimestamp)
{
-        return CAN_CREATE_SECURITY_MANAGER ? new SecurityManagerCallStack(messageFormat,
useTimestamp)
-            : new ThrowableCallStack(messageFormat, useTimestamp);
+        return CAN_CREATE_SECURITY_MANAGER ? new SecurityManagerCallStack(messageFormat,
useTimestamp) :
+            new ThrowableCallStack(messageFormat, useTimestamp);
     }
 
+    /**
+     * Hidden constructor.
+     */
     private CallStackUtils() {
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
index 3b80d58..7ea17f5 100644
--- a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
+++ b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
@@ -106,6 +106,9 @@ class EvictionTimer {
         }
     }
 
+    /**
+     * Thread factory that creates a thread, with the context classloader from this class.
+     */
     private static class EvictorThreadFactory implements ThreadFactory {
 
         @Override

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
index a366ec2..4a64b33 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
@@ -1460,6 +1460,8 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K>
{
 
     /**
      * Maintains information on the per key queue for a given key.
+     *
+     * @param <S> type of objects in the pool
      */
     private class ObjectDeque<S> {
 

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java b/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
index aa57b84..c8edf90 100644
--- a/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
+++ b/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
@@ -89,7 +89,11 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
 
     private static final long serialVersionUID = -387911632671998426L;
 
-    /** Doubly-linked list node class */
+    /**
+     * Doubly-linked list node class.
+     *
+     * @param <E> node item type
+     */
     private static final class Node<E> {
         /**
          * The item, or null if this node has been removed.

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java b/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
index 39d54bc..c4f2ae0 100644
--- a/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
+++ b/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
@@ -43,6 +43,12 @@ public class SecurityManagerCallStack implements CallStack {
 
     private volatile Snapshot snapshot;
 
+    /**
+     * Create a new instance.
+     *
+     * @param messageFormat message format
+     * @param useTimestamp whether to format the dates in the output message or not
+     */
     public SecurityManagerCallStack(final String messageFormat, final boolean useTimestamp)
{
         this.messageFormat = messageFormat;
         this.dateFormat = useTimestamp ? new SimpleDateFormat(messageFormat) : null;
@@ -85,7 +91,15 @@ public class SecurityManagerCallStack implements CallStack {
         snapshot = null;
     }
 
+    /**
+     * A custom security manager.
+     */
     private static class PrivateSecurityManager extends SecurityManager {
+        /**
+         * Get the class stack.
+         *
+         * @return class stack
+         */
         private List<WeakReference<Class<?>>> getCallStack() {
             final Class<?>[] classes = getClassContext();
             final List<WeakReference<Class<?>>> stack = new ArrayList<>(classes.length);
@@ -96,10 +110,18 @@ public class SecurityManagerCallStack implements CallStack {
         }
     }
 
+    /**
+     * A snapshot of a class stack.
+     */
     private static class Snapshot {
         private final long timestamp = System.currentTimeMillis();
         private final List<WeakReference<Class<?>>> stack;
 
+        /**
+         * Create a new snapshot with a class stack.
+         *
+         * @param stack class stack
+         */
         private Snapshot(final List<WeakReference<Class<?>>> stack) {
             this.stack = stack;
         }

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/09a4867e/src/main/java/org/apache/commons/pool2/impl/ThrowableCallStack.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/ThrowableCallStack.java b/src/main/java/org/apache/commons/pool2/impl/ThrowableCallStack.java
index 0f3baa3..3b26d67 100644
--- a/src/main/java/org/apache/commons/pool2/impl/ThrowableCallStack.java
+++ b/src/main/java/org/apache/commons/pool2/impl/ThrowableCallStack.java
@@ -36,6 +36,12 @@ public class ThrowableCallStack implements CallStack {
 
     private volatile Snapshot snapshot;
 
+    /**
+     * Create a new instance.
+     *
+     * @param messageFormat message format
+     * @param useTimestamp whether to format the dates in the output message or not
+     */
     public ThrowableCallStack(final String messageFormat, final boolean useTimestamp) {
         this.messageFormat = messageFormat;
         this.dateFormat = useTimestamp ? new SimpleDateFormat(messageFormat) : null;
@@ -70,6 +76,9 @@ public class ThrowableCallStack implements CallStack {
         snapshot = null;
     }
 
+    /**
+     * A snapshot of a throwable.
+     */
     private static class Snapshot extends Throwable {
         private final long timestamp = System.currentTimeMillis();
     }


Mime
View raw message