[jboss-cvs] JBossAS SVN: r112451 - branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/xa.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 14 13:02:31 EST 2011


Author: jesper.pedersen
Date: 2011-11-14 13:02:30 -0500 (Mon, 14 Nov 2011)
New Revision: 112451

Modified:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnectionFactory.java
Log:
[JBPAPP-7464] Change xaProps to HashMap (JDK: #6582568)

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnectionFactory.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnectionFactory.java	2011-11-14 16:01:59 UTC (rev 112450)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnectionFactory.java	2011-11-14 18:02:30 UTC (rev 112451)
@@ -34,7 +34,10 @@
 import java.io.InputStream;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
@@ -59,7 +62,7 @@
 
    private String xaDataSourceProperties;
 
-   protected final Properties xaProps = new Properties();
+   protected final Map<String, String> xaProps = Collections.synchronizedMap(new HashMap<String , String>());
 
    private Boolean isSameRMOverrideValue;
 
@@ -90,7 +93,7 @@
    {
       if(urlProperty != null && urlProperty.length() > 0)
       {
-         String urlsStr = xaProps.getProperty(urlProperty);
+         String urlsStr = xaProps.get(urlProperty);
          if(urlsStr != null && urlsStr.trim().length() > 0 && urlDelimiter != null && urlDelimiter.trim().length() > 0)
          {
             List xaDataList = new ArrayList();
@@ -99,10 +102,9 @@
             // ctor doesn't work because iteration won't include defaults
             // Properties xaPropsCopy = new Properties(xaProps);
             Properties xaPropsCopy = new Properties();
-            for(Iterator i = xaProps.keySet().iterator(); i.hasNext();)
+            for(Map.Entry<String, String> entry : xaProps.entrySet())
             {
-               Object key = i.next();
-               xaPropsCopy.put(key, xaProps.get(key));
+               xaPropsCopy.put(entry.getKey(), entry.getValue());
             }
 
             int urlStart = 0;
@@ -140,7 +142,7 @@
       }
    }
 
-   private XADataSource createXaDataSource(Properties xaProps)
+   private XADataSource createXaDataSource(Properties p)
    throws JBossResourceException
    {
    if(getXADataSourceClass() == null)
@@ -154,10 +156,10 @@
       Class clazz = Thread.currentThread().getContextClassLoader().loadClass(getXADataSourceClass());
       xads = (XADataSource)clazz.newInstance();
       Class[] NOCLASSES = new Class[]{};
-      for(Iterator i = xaProps.keySet().iterator(); i.hasNext();)
+      for(Iterator i = p.keySet().iterator(); i.hasNext();)
       {
          String name = (String)i.next();
-         String value = xaProps.getProperty(name);
+         String value = p.getProperty(name);
          char firstCharName = Character.toUpperCase(name.charAt(0));
      	 if (name.length() > 1)
      		 name = firstCharName+name.substring(1);
@@ -380,7 +382,13 @@
          InputStream is = new ByteArrayInputStream(xaDataSourceProperties.getBytes());
          try
          {
-            xaProps.load(is);
+            Properties p = new Properties();
+            p.load(is);
+
+            for (Map.Entry<Object, Object> entry: p.entrySet())
+            {
+               xaProps.put((String)entry.getKey(), (String)entry.getValue());
+            }
          }
          catch (IOException ioe)
          {
@@ -553,10 +561,10 @@
             Class clazz = Thread.currentThread().getContextClassLoader().loadClass(xaDataSourceClass);
             xads = (XADataSource) clazz.newInstance();
             Class[] NOCLASSES = new Class[] {};
-            for (Iterator i = xaProps.keySet().iterator(); i.hasNext();)
+            for (Map.Entry<String, String> entry : xaProps.entrySet())
             {
-               String name = (String) i.next();
-               String value = xaProps.getProperty(name);      
+               String name = entry.getKey();
+               String value = entry.getValue();      
                char firstCharName = Character.toUpperCase(name.charAt(0));
            	   if (name.length() > 1)
             	       name = firstCharName+name.substring(1);
@@ -623,9 +631,4 @@
       }
       return xads;
    }
-
-   protected Properties getXaProps()
-   {
-      return xaProps;
-   }
 }



More information about the jboss-cvs-commits mailing list