hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r755462 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java
Date Wed, 18 Mar 2009 02:44:14 GMT
Author: sebb
Date: Wed Mar 18 02:44:13 2009
New Revision: 755462

URL: http://svn.apache.org/viewvc?rev=755462&view=rev
Log:
Inline private init method so as to make class immutable

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java?rev=755462&r1=755461&r2=755462&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/Punycode.java
Wed Mar 18 02:44:13 2009
@@ -30,27 +30,29 @@
 
 package org.apache.http.client.utils;
 
+import net.jcip.annotations.Immutable;
+
 /**
  * Facade that provides conversion between Unicode and Punycode domain names.
  * It will use an appropriate implementation.
  *
  * @since 4.0
  */
+@Immutable
 public class Punycode {
-    private static Idn impl;
+    private static final Idn impl;
     static {
-        init();
+        Idn _impl;
+        try {
+            _impl = new JdkIdn();
+        } catch (Exception e) {
+            _impl = new Rfc3492Idn();
+        }
+        impl = _impl;
     }
     
     public static String toUnicode(String punycode) {
         return impl.toUnicode(punycode);
     }
     
-    private static void init() {
-        try {
-            impl = new JdkIdn();
-        } catch (Exception e) {
-            impl = new Rfc3492Idn();
-        }
-    }
 }



Mime
View raw message