db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1198653 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/store/access/ engine/org/apache/derby/iapi/types/ engine/org/apache/derby/impl/load/ engine/org/apache...
Date Mon, 07 Nov 2011 09:01:17 GMT
Author: kahatlen
Date: Mon Nov  7 09:01:16 2011
New Revision: 1198653

URL: http://svn.apache.org/viewvc?rev=1198653&view=rev
Log:
DERBY-5491: new String("") or new String() is pointless, and just allocates memory needlessly

Patch contributed by Dave Brosius <dbrosius@apache.org>.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/RowUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/D_BTreeController.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/D_HeapController.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java Mon Nov
 7 09:01:16 2011
@@ -1354,7 +1354,7 @@ public abstract class DatabaseMetaData i
             cs.setStringX(3, tableNamePattern);
         }
 
-        String tableTypes = new String();
+        String tableTypes = "";
         int i = 0;
         if (types == null) {
             cs.setNullX(4, java.sql.Types.VARCHAR);
@@ -2070,7 +2070,7 @@ public abstract class DatabaseMetaData i
         cs.setStringX(2, schemaPattern);
         cs.setStringX(3, typeNamePattern);
         int i = 0;
-        String udtTypes = new String();
+        String udtTypes = "";
         while (types != null && i < types.length) {
             if (i > 0) {
                 udtTypes = udtTypes.concat(",");

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Mon Nov 
7 09:01:16 2011
@@ -6141,7 +6141,7 @@ class DRDAConnThread extends Thread {
 	 * <code>SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER</code>, When full message text
is 
 	 * sent for severe errors. This value separates the messages. 
 	 */
-	private static String SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER = new String("::");
+	private static String SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER = "::";
 	
 	/**
 	 * Create error message or message argements to return to client.  

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/RowUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/RowUtil.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/RowUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/RowUtil.java Mon Nov
 7 09:01:16 2011
@@ -444,7 +444,7 @@ public class RowUtil
         if (SanityManager.DEBUG)
         {
 
-            String str = new String();
+            String str = "";
 
             if (row != null)
             {
@@ -485,7 +485,7 @@ public class RowUtil
     {
         if (SanityManager.DEBUG)
         {
-            String str = new String();
+            String str = "";
 
             Object  row_or_vector;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java Mon Nov  7 09:01:16
2011
@@ -2258,7 +2258,7 @@ readingLoop:
         {
             throw StandardException.newException(
                     SQLState.LANG_INVALID_PARAMETER_FOR_SEARCH_POSITION, 
-                    new String(getString()), new String(mySearchFrom), 
+                    getString(), mySearchFrom,
                     new Integer(startVal));
         }
         

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java
Mon Nov  7 09:01:16 2011
@@ -175,7 +175,7 @@ final class WorkHorseForCollatorDatatype
 				(escapeCharacter.getCountOfCollationElements() != 1))
 		{
 			throw StandardException.newException(SQLState.LANG_INVALID_ESCAPE_CHARACTER,
-					new String(escapeCharacter.toString()));
+					escapeCharacter.toString());
 		}
 		likeResult = Like.like(stringData.getCharArray(), 
 				stringData.getLength(), 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java Mon Nov
 7 09:01:16 2011
@@ -183,7 +183,7 @@ final class ExportWriteData extends Expo
 
     //do uppercase because the ui shows the values as True and False
     if (columnDefinition.toUpperCase(java.util.Locale.ENGLISH).equals(ControlInfo.INTERNAL_TRUE.toUpperCase(java.util.Locale.ENGLISH)))
{
-       String tempStr=new String();
+       String tempStr="";
        //put the start and stop delimiters around the column name and type
        for (int i=0; i<columnNames.length; i++) {
 		 // take care at adding fieldSeparator at the 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
Mon Nov  7 09:01:16 2011
@@ -923,7 +923,7 @@ forever:	for (;;) {
     {
         if (SanityManager.DEBUG)
         {
-            String str = new String();
+            String str = "";
 
             int i = 0;
             for (Entry entry : locks.values())

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java Mon
Nov  7 09:01:16 2011
@@ -703,7 +703,7 @@ forever:	for (;;) {
     {
         if (SanityManager.DEBUG)
         {
-            String str = new String();
+            String str = "";
 
             int i = 0;
             for (Iterator it = locks.values().iterator(); it.hasNext(); )

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
Mon Nov  7 09:01:16 2011
@@ -941,7 +941,7 @@ public class RAMTransaction 
         if (SanityManager.DEBUG)
         {
 
-            str = new String();
+            str = "";
 
             for (Iterator it = scanControllers.iterator(); it.hasNext(); )
             {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/D_BTreeController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/D_BTreeController.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/D_BTreeController.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/D_BTreeController.java
Mon Nov  7 09:01:16 2011
@@ -189,7 +189,7 @@ public class D_BTreeController extends D
     Properties  prop,
     LevelInfo   li)
     {
-        String ret_string   = new String();
+        String ret_string   = "";
 
         ret_string += 
             "Btree conglom has:\n" + 
@@ -259,7 +259,7 @@ public class D_BTreeController extends D
     Properties  prop,
     LevelInfo   level_info[])
     {
-        String ret_string   = new String();
+        String ret_string   = "";
         LevelInfo   total   = new LevelInfo();
 
         // first tabulate totals for all levels
@@ -318,7 +318,7 @@ public class D_BTreeController extends D
     Properties  prop,
     LevelInfo   level_info[])
     {
-        String ret_string   = new String();
+        String ret_string   = "";
         long   total_pages  = 0;
         long   total_res    = 0;
 
@@ -395,7 +395,7 @@ public class D_BTreeController extends D
         ControlRow  root        = null;
         int         tree_height;
         LevelInfo   level_info[] = null;
-        String      diag_info    = new String();
+        String      diag_info    = "";
 
         
         try

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/D_HeapController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/D_HeapController.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/D_HeapController.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/D_HeapController.java
Mon Nov  7 09:01:16 2011
@@ -140,7 +140,7 @@ public class D_HeapController extends Di
     Properties  prop,
     TableStats stat)
     {
-        String ret_string   = new String();
+        String ret_string   = "";
 
         // Totals:
         ret_string += 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
Mon Nov  7 09:01:16 2011
@@ -1050,8 +1050,7 @@ public class BaseContainerHandle extends
     {
         if (SanityManager.DEBUG)
         {
-            String str = new String();
-            str += "BaseContainerHandle:(" + identity.toString() + ")";
+            String str = "BaseContainerHandle:(" + identity.toString() + ")";
             return(str);
         }
         else

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java Mon
Nov  7 09:01:16 2011
@@ -2831,7 +2831,7 @@ abstract class BasePage implements Page,
 		if (SanityManager.DEBUG)
 		{
             StoredRecordHeader rh;
-			str = new String();
+			str = "";
 
             for (int slot = FIRST_SLOT_NUMBER; slot < recordCount; slot++) {
                 rh = getHeaderAtSlot(slot);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java Mon
Nov  7 09:01:16 2011
@@ -8165,7 +8165,7 @@ public class StoredPage extends CachedPa
     {
         if (SanityManager.DEBUG)
         {
-            String str = new String();
+            String str = "";
             try 
             {
                 StoredRecordHeader recordHeader = getHeaderAtSlot(slot);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java?rev=1198653&r1=1198652&r2=1198653&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
Mon Nov  7 09:01:16 2011
@@ -308,8 +308,7 @@ final class StreamFileContainerHandle 
 	*/
 	public String toString() {
         if (SanityManager.DEBUG) {
-            String str = new String();
-            str += "StreamContainerHandle:(" + identity.toString() + ")";
+            String str = "StreamContainerHandle:(" + identity.toString() + ")";
             return(str);
         } else {
             return(super.toString());



Mime
View raw message