[jboss-svn-commits] JBL Code SVN: r30145 - labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 13 16:30:02 EST 2009


Author: mark.little at jboss.com
Date: 2009-11-13 16:30:01 -0500 (Fri, 13 Nov 2009)
New Revision: 30145

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java
Log:
https://jira.jboss.org/jira/browse/JBTM-592

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java	2009-11-13 21:09:28 UTC (rev 30144)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java	2009-11-13 21:30:01 UTC (rev 30145)
@@ -51,6 +51,12 @@
  * @since JTS 1.0.
  */
 
+/**
+ * @message com.arjuna.ats.arjuna.utils.Utility_2
+ *          [com.arjuna.ats.arjuna.utils.Utility_2] -
+ *          Unable to use InetAddress.getLocalHost() to resolve address.
+ */
+
 public class Utility
 {
 
@@ -190,8 +196,20 @@
             myAddr[1] = 0;
             
             byte[] b = null;
-            InetAddress addr = InetAddress.getLocalHost();
+            InetAddress addr;
 
+            try
+            { 
+                addr = InetAddress.getLocalHost(); 
+            }
+            catch (final UnknownHostException uhe)
+            { 
+                if (tsLogger.arjLoggerI18N.isWarnEnabled())
+                    tsLogger.arjLoggerI18N.warn("Utility_2");
+
+                addr = InetAddress.getByName(null); 
+            } 
+             
             if (addr instanceof Inet6Address)
             {
                 // 16 bytes to work with.
@@ -336,6 +354,7 @@
      *          [com.arjuna.ats.arjuna.utils.Utility_1] -
      *          Utility.getDefaultProcess - failed with
      */
+    @SuppressWarnings("unchecked")
     private static synchronized void initDefaultProcess ()
     {
         if(processHandle == null)
@@ -346,9 +365,10 @@
 
                 processHandle = (Process) c.newInstance();
             }
-            catch (Exception e)
+            catch (final Exception e)
             {
-                tsLogger.arjLoggerI18N.warn("Utility_1", e);
+                if (tsLogger.arjLoggerI18N.isWarnEnabled())
+                    tsLogger.arjLoggerI18N.warn("Utility_1", e);
             }
         }
     }



More information about the jboss-svn-commits mailing list