commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r801639 - /commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java
Date Thu, 06 Aug 2009 13:15:11 GMT
Author: niallp
Date: Thu Aug  6 13:15:10 2009
New Revision: 801639

URL: http://svn.apache.org/viewvc?rev=801639&view=rev
Log:
Make new charsetName instance variable thread-safe

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java?rev=801639&r1=801638&r2=801639&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java Thu Aug 
6 13:15:10 2009
@@ -167,13 +167,14 @@
         return digit;
     }
 
-    private String charsetName = DEFAULT_CHARSET_NAME;
+    private final String charsetName;
 
     /**
      * Creates a new codec with the default charset name {@link #DEFAULT_CHARSET_NAME}
      */
     public Hex() {
         // use default encoding
+        this.charsetName = DEFAULT_CHARSET_NAME;
     }
 
     /**
@@ -181,9 +182,10 @@
      * 
      * @param csName
      *            the charset name.
+     * @since 1.4
      */
     public Hex(String csName) {
-        setCharsetName(csName);
+        this.charsetName = csName;
     }
 
     /**
@@ -280,22 +282,13 @@
      * Gets the charset name.
      * 
      * @return the charset name.
+     * @since 1.4
      */
     public String getCharsetName() {
         return this.charsetName;
     }
 
     /**
-     * Sets the charset name.
-     * 
-     * @param charsetName
-     *            the charset name.
-     */
-    private void setCharsetName(String charsetName) {
-        this.charsetName = charsetName;
-    }
-
-    /**
      * Returns a string representation of the object, which includes the charset name.
      * 
      * @return a string representation of the object.



Mime
View raw message