You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2008/02/22 15:54:56 UTC

svn commit: r630221 - in /commons/proper/configuration/branches/configuration2_experimental: ./ conf/ src/main/java/org/apache/commons/configuration2/ src/main/java/org/apache/commons/configuration2/plist/

Author: ebourg
Date: Fri Feb 22 06:54:53 2008
New Revision: 630221

URL: http://svn.apache.org/viewvc?rev=630221&view=rev
Log:
Configured the Maven 2 Checkstyle plugin
Changed the Checkstyle settings to avoid false positives with the Java 5 syntax
Fixed some checkstyle warnings

Modified:
    commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml
    commons/proper/configuration/branches/configuration2_experimental/pom.xml
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Base64.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Hex.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml Fri Feb 22 06:54:53 2008
@@ -58,7 +58,7 @@
         <!-- Checks for Headers                              -->
         <!-- See http://checkstyle.sf.net/config_header.html -->
         <module name="Header">
-            <property name="headerFile" value="${basedir}/conf/HEADER.txt"/>
+            <property name="headerFile" value="conf/HEADER.txt"/>
             <property name="ignoreLines" value="2"/>
         </module>
 
@@ -93,7 +93,10 @@
         <module name="ParenPad"/>
         <module name="TabCharacter"/>
         <module name="WhitespaceAfter"/>
-        <module name="WhitespaceAround"/>
+        <module name="WhitespaceAround">
+          <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
+        </module>
+
 
 
         <!-- Modifier Checks                                    -->

Modified: commons/proper/configuration/branches/configuration2_experimental/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/pom.xml?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/pom.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/pom.xml Fri Feb 22 06:54:53 2008
@@ -359,6 +359,13 @@
             <outputDirectory>src/main/java</outputDirectory>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>conf/checkstyle.xml</configLocation>
+          </configuration>
+        </plugin>
       </plugins>
     </build>
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java Fri Feb 22 06:54:53 2008
@@ -245,7 +245,7 @@
                 Object value = subset.getProperty(key);
                 if (value instanceof Collection)
                 {
-                    for (Object val : ((Collection) value))
+                    for (Object val : (Collection) value)
                     {
                         out.print(key);
                         out.print(" = ");
@@ -397,7 +397,7 @@
         }
 
         String v = result.toString();
-        if(!quoted)
+        if (!quoted)
         {
             v = v.trim();
         }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Base64.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Base64.java?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Base64.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Base64.java Fri Feb 22 06:54:53 2008
@@ -34,35 +34,35 @@
     /** The current value being converted. */
     private String value;
 
-	private Base64()
-	{
-		super(null, "");
-	}
+    private Base64()
+    {
+        super(null, "");
+    }
 
-	public static synchronized String encodeBase64(byte[] array)
-	{
-		instance.putByteArray(null, array);
-		return instance.get(null, null);
-	}
+    public static synchronized String encodeBase64(byte[] array)
+    {
+        instance.putByteArray(null, array);
+        return instance.get(null, null);
+    }
 
-	public static synchronized byte[] decodeBase64(String base64String)
-	{
-		instance.put(null, base64String);
-		return instance.getByteArray(null, null);
-	}
+    public static synchronized byte[] decodeBase64(String base64String)
+    {
+        instance.put(null, base64String);
+        return instance.getByteArray(null, null);
+    }
 
-	public String get(String key, String defaultValue)
-	{
-		return value;
-	}
+    public String get(String key, String defaultValue)
+    {
+        return value;
+    }
 
     /**
      * Overrides the default implementation to avoid the constraint on the length of the value.
      */
     public void put(String key, String value)
-	{
-		this.value = value;
-	}
+    {
+        this.value = value;
+    }
 
     protected void putSpi(String key, String value)
     {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Hex.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Hex.java?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Hex.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Hex.java Fri Feb 22 06:54:53 2008
@@ -18,14 +18,14 @@
 package org.apache.commons.configuration2.plist;
 
 /**
- * Hex encoder and decoder. This is a modified copy of the Hex class in Commons Codec 
+ * Hex encoder and decoder. This is a modified copy of the Hex class in Commons Codec
  *
- * @since 2.0
  * @author Apache Software Foundation
  * @version $Id$
+ * @since 2.0
  */
-class Hex {
-
+class Hex
+{
     /**
      * Used to build output as Hex
      */
@@ -43,18 +43,21 @@
      *         the supplied char array.
      * @throws Exception Thrown if an odd number or illegal of characters is supplied
      */
-    public static byte[] decodeHex(char[] data) throws Exception {
+    public static byte[] decodeHex(char[] data) throws Exception
+    {
 
         int len = data.length;
 
-        if ((len & 0x01) != 0) {
+        if ((len & 0x01) != 0)
+        {
             throw new Exception("Odd number of characters.");
         }
 
         byte[] out = new byte[len >> 1];
 
         // two characters form the hex value.
-        for (int i = 0, j = 0; j < len; i++) {
+        for (int i = 0, j = 0; j < len; i++)
+        {
             int f = toDigit(data[j], j) << 4;
             j++;
             f = f | toDigit(data[j], j);
@@ -68,14 +71,16 @@
     /**
      * Converts a hexadecimal character to an integer.
      *
-     * @param ch A character to convert to an integer digit
+     * @param ch    A character to convert to an integer digit
      * @param index The index of the character in the source
      * @return An integer
      * @throws Exception Thrown if ch is an illegal hex character
      */
-    protected static int toDigit(char ch, int index) throws Exception {
+    protected static int toDigit(char ch, int index) throws Exception
+    {
         int digit = Character.digit(ch, 16);
-        if (digit == -1) {
+        if (digit == -1)
+        {
             throw new Exception("Illegal hexadecimal charcter " + ch + " at index " + index);
         }
         return digit;
@@ -86,23 +91,23 @@
      * The returned array will be double the length of the passed array, as it takes two characters to represent any
      * given byte.
      *
-     * @param data
-     *                  a byte[] to convert to Hex characters
+     * @param data a byte[] to convert to Hex characters
      * @return A char[] containing hexidecimal characters
      */
-    public static char[] encodeHex(byte[] data) {
+    public static char[] encodeHex(byte[] data)
+    {
 
         int l = data.length;
 
-           char[] out = new char[l << 1];
+        char[] out = new char[l << 1];
 
-           // two characters form the hex value.
-           for (int i = 0, j = 0; i < l; i++) {
-               out[j++] = DIGITS[(0xF0 & data[i]) >>> 4 ];
-               out[j++] = DIGITS[ 0x0F & data[i] ];
-           }
+        // two characters form the hex value.
+        for (int i = 0, j = 0; i < l; i++)
+        {
+            out[j++] = DIGITS[(0xF0 & data[i]) >>> 4];
+            out[j++] = DIGITS[0x0F & data[i]];
+        }
 
-           return out;
+        return out;
     }
 }
-

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java Fri Feb 22 06:54:53 2008
@@ -86,17 +86,17 @@
     /** The default date format, its use must be synchronized */
     private static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("<*'D'yyyy-MM-dd HH:mm:ss Z>");
 
-    /**
-     * Instance specific format that can be used to format a date in differents time zones.
-     * Its use must be synchronized
-     */
-    final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DEFAULT_DATE_FORMAT.toPattern());
-
     /** The serial version UID. */
     private static final long serialVersionUID = 3227248503779092127L;
 
     /** Size of the indentation for the generated file. */
     private static final int INDENT_SIZE = 4;
+
+    /**
+     * Instance specific format that can be used to format a date in differents time zones.
+     * Its use must be synchronized
+     */
+    final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DEFAULT_DATE_FORMAT.toPattern());
 
     /**
      * Creates an empty PropertyListConfiguration object which can be

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java?rev=630221&r1=630220&r2=630221&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java Fri Feb 22 06:54:53 2008
@@ -350,7 +350,7 @@
         else if (value instanceof List)
         {
             out.println(padding + "<array>");
-            for (Object val : ((List) value))
+            for (Object val : (List) value)
             {
                 printValue(out, indentLevel + 1, val);
             }