Author: manik.surtani(a)jboss.com
Date: 2008-06-26 18:56:53 -0400 (Thu, 26 Jun 2008)
New Revision: 6072
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java
core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java
core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
Log:
Converted StringBuffers to StringBuilders.
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26
21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -14,7 +14,12 @@
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* A container for the root node in the cache, which also provides helpers for
efficiently accessing nodes, walking trees, etc.
@@ -293,7 +298,7 @@
@SuppressWarnings("deprecation")
public String toString(boolean details)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int indent = 0;
if (!details)
@@ -363,7 +368,7 @@
*/
public String printDetails()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
root.printDetails(sb, 0);
sb.append("\n");
return sb.toString();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java 2008-06-26
21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -266,7 +266,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(type.toString()).append(": ").append(fqn);
if (key != null)
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 21:43:56 UTC
(rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 22:56:53 UTC
(rev 6072)
@@ -151,21 +151,21 @@
void addChild(Object nodeName, Node<K, V> nodeToAdd);
/**
- * Prints details of this node to the StringBuffer passed in.
+ * Prints details of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending
spaces.
*/
- void printDetails(StringBuffer sb, int indent);
+ void printDetails(StringBuilder sb, int indent);
/**
- * Prints basic information of this node to the StringBuffer passed in.
+ * Prints basic information of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending
spaces.
*/
@Deprecated
- void print(StringBuffer sb, int indent);
+ void print(StringBuilder sb, int indent);
// versioning
/**
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26
21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -306,7 +306,7 @@
return data.remove(key);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
printDetailsInMap(sb, indent);
}
@@ -555,7 +555,7 @@
throw new UnsupportedOperationException("Versioning not supported");
}
- private void printIndent(StringBuffer sb, int indent)
+ private void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -659,7 +659,7 @@
/**
* Adds details of the node into a map as strings.
*/
- private void printDetailsInMap(StringBuffer sb, int indent)
+ private void printDetailsInMap(StringBuilder sb, int indent)
{
printIndent(sb, indent);
indent += 2;// increse it
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java 2008-06-26 21:43:56 UTC
(rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java 2008-06-26 22:56:53 UTC
(rev 6072)
@@ -46,7 +46,7 @@
public static String printVersionId(byte[] v, int len)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
if (len <= 0)
@@ -59,7 +59,7 @@
public static String printVersionId(byte[] v)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
for (byte aV : v) sb.append((char) aV);
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -439,7 +439,7 @@
@Override
public String toString()
{
- StringBuffer buf = new StringBuffer("ChainingCacheLoader{");
+ StringBuilder buf = new StringBuilder("ChainingCacheLoader{");
Iterator<CacheLoader> i = cacheLoaders.iterator();
Iterator<CacheLoaderConfig.IndividualCacheLoaderConfig> c =
cacheLoaderConfigs.iterator();
int count = 0;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -79,7 +79,7 @@
*/
public static final Pattern FQN_PATTERN =
Pattern.compile("[\\\\\\/:*<>|\"?]");
private static boolean isOldWindows;
-
+
static
{
float osVersion = -1;
@@ -407,7 +407,7 @@
String getFullPath(Fqn fqn)
{
- StringBuffer sb = new StringBuffer(rootPath);
+ StringBuilder sb = new StringBuilder(rootPath);
for (int i = 0; i < fqn.size(); i++)
{
Object tmp = fqn.get(i);
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -188,7 +188,7 @@
}
else
{
- StringBuffer sql = new StringBuffer(300);
+ StringBuilder sql = new StringBuilder(300);
sql.append("delete from ").append(config.getTable()).append("
where fqn in (");
//sql2.append("delete from " + table + " where fqn=? or parent
in (");
List fqns = new ArrayList();
@@ -244,7 +244,7 @@
// Private
- private void addChildrenToDeleteSql(String name, StringBuffer sql, List fqns)
+ private void addChildrenToDeleteSql(String name, StringBuilder sql, List fqns)
throws SQLException
{
// for now have to use connection per method, i.e. can't pass the same
connection to recursive
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -102,7 +102,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("GlobalTransaction:<").append(addr).append(">:").append(id);
return sb.toString();
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -33,7 +33,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer(super.toString());
+ StringBuilder sb = new StringBuilder(super.toString());
sb.append("\nworkspace: ").append(transactionWorkSpace);
return sb.toString();
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -305,7 +305,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("TransactionEntry\nmodificationList:
").append(modificationList);
synchronized (locks)
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -203,7 +203,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(tx2gtxMap.size()).append(" mappings, ");
sb.append(gtx2EntryMap.size()).append(" transactions");
return sb.toString();
@@ -216,7 +216,7 @@
{
if (!printDetails)
return toString();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("LocalTransactions:
").append(tx2gtxMap.size()).append("\n");
sb.append("GlobalTransactions:
").append(gtx2EntryMap.size()).append("\n");
sb.append("tx2gtxMap:\n");
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -92,7 +92,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26
21:43:56 UTC (rev 6071)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -6,18 +6,12 @@
*/
package org.jboss.cache.loader;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
+import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
-import org.testng.annotations.AfterMethod;
import java.util.Properties;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-
/**
* This test runs cache loader tests using Database as the cache loader store.
* The default test is configured using Derby embedded framework.
@@ -60,7 +54,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
@@ -79,7 +73,8 @@
retVal = loader.put(FQN, key, updatedValue);
assertEquals(initialValue, (String) retVal);
assertEquals(updatedValue, (String) loader.get(FQN).get(key));
- } catch (Exception e)
+ }
+ catch (Exception e)
{
fail(e.toString());
}
@@ -99,9 +94,9 @@
}
}
- public void testRootIsCreated() throws Exception
- {
- loader.put(Fqn.fromString("/a/b/c"), "a", "b");
- assertTrue(loader.exists(Fqn.ROOT));
- }
+ public void testRootIsCreated() throws Exception
+ {
+ loader.put(Fqn.fromString("/a/b/c"), "a", "b");
+ assertTrue(loader.exists(Fqn.ROOT));
+ }
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26
21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26
22:56:53 UTC (rev 6072)
@@ -1,14 +1,17 @@
package org.jboss.cache.mock;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
/**
* @author Mircea.Markus(a)jboss.com
@@ -117,12 +120,12 @@
((NodeSpiMock) nodeToAdd).fqn = Fqn.fromRelativeElements(fqn, nodeName);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
//skip
}
- public void print(StringBuffer sb, int indent)
+ public void print(StringBuilder sb, int indent)
{
//skip
}
@@ -169,7 +172,7 @@
Object directChildName = childName.get(0);
NodeSpiMock directChild = children.get(directChildName);
Fqn subFqn = childName.getSubFqn(1, childName.size());
- if(directChild == null)
+ if (directChild == null)
{
directChild = newChild(directChildName);
}
@@ -356,7 +359,8 @@
{
data.put(key, newValue);
return true;
- } else
+ }
+ else
return false;
}
@@ -367,7 +371,7 @@
public void replaceAll(Map map)
{
- data = map;
+ data = map;
}
public Object get(Object key)