commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1766134 - in /commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile: DynamicField.java EntityMap.java PadJustifyFieldSupport.java dsl/ParserEntityFactory.java util/RepeatingInputStream.java
Date Fri, 21 Oct 2016 21:17:26 GMT
Author: mbenson
Date: Fri Oct 21 21:17:25 2016
New Revision: 1766134

URL: http://svn.apache.org/viewvc?rev=1766134&view=rev
Log:
code cleanup

Modified:
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/DynamicField.java
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityMap.java
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/PadJustifyFieldSupport.java
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/util/RepeatingInputStream.java

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/DynamicField.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/DynamicField.java?rev=1766134&r1=1766133&r2=1766134&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/DynamicField.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/DynamicField.java
Fri Oct 21 21:17:25 2016
@@ -117,8 +117,8 @@ public class DynamicField extends PadJus
          * @param maximum int
          */
         public void setMaximum(int maximum) {
-            Validate.isTrue(maximum <= ALL_VALID.getMaximum(), "maximum value > ",
-                    + ALL_VALID.getMaximum(), maximum);
+            Validate.isTrue(maximum <= ALL_VALID.getMaximum(), "maximum value %d >
%d", maximum,
+                ALL_VALID.getMaximum());
             this.maximum = maximum;
         }
 
@@ -135,8 +135,8 @@ public class DynamicField extends PadJus
          * @param minimum int
          */
         public void setMinimum(int minimum) {
-            Validate.isTrue(minimum >= ALL_VALID.getMinimum(), "minimum value < "
-                    + ALL_VALID.getMinimum(), minimum);
+            Validate.isTrue(minimum >= ALL_VALID.getMinimum(), "minimum value %s <
%s", minimum,
+                ALL_VALID.getMinimum());
             this.minimum = minimum;
         }
 

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityMap.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityMap.java?rev=1766134&r1=1766133&r2=1766134&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityMap.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityMap.java
Fri Oct 21 21:17:25 2016
@@ -45,6 +45,7 @@ public class EntityMap extends EntityCol
         private static final long serialVersionUID = 2347729609002856564L;
 
         private final String name;
+        @SuppressWarnings("PMD.UnusedPrivateField") // false positive; this field is used
in EntityMap#clone()
         private final Entity entity;
 
         /**
@@ -79,6 +80,10 @@ public class EntityMap extends EntityCol
 
         private final List<Child> wrapped;
 
+        /**
+         * Create a new {@link ChildrenList} wrapping the specified {@link List}.
+         * @param wrapped {@link List}
+         */
         private ChildrenList(List<Child> wrapped) {
             super();
             this.wrapped = wrapped;

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/PadJustifyFieldSupport.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/PadJustifyFieldSupport.java?rev=1766134&r1=1766133&r2=1766134&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/PadJustifyFieldSupport.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/PadJustifyFieldSupport.java
Fri Oct 21 21:17:25 2016
@@ -79,8 +79,7 @@ public abstract class PadJustifyFieldSup
             protected InputStream getInputStream(byte[] src, PadJustifyFieldSupport dest)
{
                 final int dlen = dest.getPadJustifyLength();
                 // it would be odd and therefore hopefully rare to center a
-                // field that allowed overflow,
-                // but we'll provide for it:
+                // field that allowed overflow, but we'll provide for it:
                 if (dlen < src.length) {
                     return new ByteArrayInputStream(src,
                         (src.length - dlen) / 2, dlen);

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java?rev=1766134&r1=1766133&r2=1766134&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java
Fri Oct 21 21:17:25 2016
@@ -311,6 +311,12 @@ public class ParserEntityFactory impleme
         return entityMap;
     }
 
+    /**
+     * Perform some function against a borrowed {@link EntityTreeParser} instance from the
pool.
+     * @param xform function
+     * @param <T> expected result type of {@code xform}
+     * @return result from invoking {@code xform.transform(entityTreeParser)}
+     */
     private <T> T doWithPooledTreeParser(Transformer<EntityTreeParser, T> xform)
{
         EntityTreeParser entityTreeParser;
         try {

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/util/RepeatingInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/util/RepeatingInputStream.java?rev=1766134&r1=1766133&r2=1766134&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/util/RepeatingInputStream.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/util/RepeatingInputStream.java
Fri Oct 21 21:17:25 2016
@@ -25,11 +25,14 @@ import org.apache.commons.lang3.Validate
  * Provides factory methods to return InputStreams that return a repeating
  * ordered sequence of bytes, optionally limiting output to some maximum total
  * size.
- * 
+ *
  * @version $Revision$ $Date: 2009-03-24 16:09:19 -0500 (Tue, 24 Mar
  *          2009) $
  */
 public abstract class RepeatingInputStream {
+    /**
+     * Construct a new {@link RepeatingInputStream} instance.
+     */
     private RepeatingInputStream() {
     }
 
@@ -41,9 +44,8 @@ public abstract class RepeatingInputStre
 
         /**
          * Create a new RepeatOneByte instance.
-         * 
-         * @param b
-         *            byte to repeat
+         *
+         * @param b byte to repeat
          */
         private RepeatOneByte(byte b) {
             this.b = b;
@@ -66,9 +68,8 @@ public abstract class RepeatingInputStre
 
         /**
          * Create a new RepeatArray instance.
-         * 
-         * @param b
-         *            byte[] to repeat
+         *
+         * @param b byte[] to repeat
          */
         private RepeatArray(byte[] b) {
             this.b = b;
@@ -100,11 +101,9 @@ public abstract class RepeatingInputStre
 
         /**
          * Create a new LimitedOutput instance.
-         * 
-         * @param source
-         *            wrapped InputStream
-         * @param bytesToReturn
-         *            int max
+         *
+         * @param source wrapped InputStream
+         * @param bytesToReturn int max
          */
         private LimitedOutput(InputStream source, int bytesToReturn) {
             this.source = source;
@@ -130,17 +129,14 @@ public abstract class RepeatingInputStre
      * Holds cached instances of single-byte RepeatingInputStreams, with enough
      * space for every unique byte value.
      */
-    private static InputStream[] REPEAT_BYTE = new InputStream[(int) Math.pow(
-        2, Byte.SIZE)];
+    private static final InputStream[] REPEAT_BYTE = new InputStream[(int) Math.pow(2, Byte.SIZE)];
 
     /**
      * Get an InputStream that will return the specified byte[] forever.
-     * 
-     * @param b
-     *            byte[] to repeat
-     * @return InputStream
-     * @throws NullPointerException
-     *             if {@code b} is {@code null}
+     *
+     * @param b byte[] to repeat
+     * @return {@link InputStream}
+     * @throws NullPointerException if {@code b} is {@code null}
      */
     public static InputStream of(byte... b) {
         Validate.notNull(b);
@@ -159,14 +155,11 @@ public abstract class RepeatingInputStre
     /**
      * Get an InputStream that will return the specified byte sequence until a
      * total of {@code limit} bytes have been returned.
-     * 
-     * @param limit
-     *            int
-     * @param b
-     *            byte[] to repeat
-     * @return InputStream
-     * @throws NullPointerException
-     *             if {@code b} is {@code null}
+     *
+     * @param limit int
+     * @param b byte[] to repeat
+     * @return {@link InputStream}
+     * @throws NullPointerException if {@code b} is {@code null}
      */
     public static synchronized InputStream withLimit(int limit, byte... b) {
         return new LimitedOutput(of(b), limit);



Mime
View raw message