db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1475809 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/io/ iapi/sql/dictionary/ iapi/types/ impl/sql/execute/ impl/sql/execute/rts/
Date Thu, 25 Apr 2013 14:57:02 GMT
Author: rhillegas
Date: Thu Apr 25 14:57:01 2013
New Revision: 1475809

URL: http://svn.apache.org/r1475809
Log:
DERBY-6202: Cleanup mutability issues in org.apache.derby.iapi.sql.dictionary package.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/IndexLister.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PasswordHasher.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/StatisticsDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/UserDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java Thu Apr
25 14:57:01 2013
@@ -73,6 +73,26 @@ public abstract class ArrayUtil
         return (original == null) ? null : (int[]) original.clone();
     }
 
+    /** Copy a (possibly null) array of longs */
+    public  static  long[]   copy( long[] original )
+    {
+        return (original == null) ? null : (long[]) original.clone();
+    }
+
+    /** Copy a (possibly null) 2-dimensional array of ints */
+    public  static  int[][]   copy2( int[][] original )
+    {
+        if ( original == null ) { return null; }
+
+        int[][] result = new int[ original.length ][];
+        for ( int i = 0; i < original.length; i++ )
+        {
+            result[ i ] = copy( original[ i ] );
+        }
+        
+        return result;
+    }
+
     /**
      * Make the contents of an array available as a read-only list. If the
      * array is null, an empty list will be returned.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java
Thu Apr 25 14:57:01 2013
@@ -26,6 +26,7 @@ import java.util.Properties;
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
 import org.apache.derby.iapi.sql.execute.ExecRow;
@@ -239,8 +240,8 @@ public abstract	class CatalogRowFactory
 				indexNames[ictr] = generateIndexName(ictr);
 				indexUUID[ictr] = uf.recreateUUID(uuidStrings[ictr + 2 ]);
 			}
-			this.indexColumnPositions = indexColumnPositions;
-			this.indexUniqueness = indexUniqueness;
+			this.indexColumnPositions = ArrayUtil.copy2( indexColumnPositions );
+			this.indexUniqueness = ArrayUtil.copy( indexUniqueness );
  
 		}
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -28,6 +28,7 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
 import org.apache.derby.iapi.store.access.TransactionController;
@@ -229,7 +230,7 @@ public final class ConglomerateDescripto
 	 */
 	public void setColumnNames(String[] columnNames)
 	{
-		this.columnNames = columnNames;
+		this.columnNames = ArrayUtil.copy( columnNames );
 	}
 
 	/**
@@ -240,7 +241,7 @@ public final class ConglomerateDescripto
 	 */
 	public String[] getColumnNames()
 	{
-		return columnNames;
+		return ArrayUtil.copy( columnNames );
 	}
 
 	//

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -29,6 +29,7 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.catalog.UUID;
 
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.catalog.DependableFinder;
 import org.apache.derby.catalog.Dependable;
@@ -200,7 +201,7 @@ public abstract class ConstraintDescript
 	 */
 	public int[]	getReferencedColumns()
 	{
-		return referencedColumns;
+		return ArrayUtil.copy( referencedColumns );
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/IndexLister.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/IndexLister.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/IndexLister.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/IndexLister.java
Thu Apr 25 14:57:01 2013
@@ -23,6 +23,8 @@ package org.apache.derby.iapi.sql.dictio
 
 import org.apache.derby.iapi.error.StandardException;
 
+import org.apache.derby.iapi.services.io.ArrayUtil;
+
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;
@@ -85,7 +87,7 @@ public class IndexLister
 					throws StandardException
 	{
 		if ( indexRowGenerators == null ) { getAllIndexes(); }
-		return	indexRowGenerators;
+		return	(IndexRowGenerator[]) ArrayUtil.copy( indexRowGenerators );
 	}
 
     /**
@@ -99,7 +101,7 @@ public class IndexLister
 					throws StandardException
 	{
 		if ( indexConglomerateNumbers == null ) { getAllIndexes(); }
-		return	indexConglomerateNumbers;
+		return	ArrayUtil.copy( indexConglomerateNumbers );
 	}
 
     /**
@@ -112,7 +114,7 @@ public class IndexLister
     public	String[]		getIndexNames()	throws StandardException
 	{
 		if ( indexNames == null ) { getAllIndexes(); }
-		return	indexNames;
+		return	ArrayUtil.copy( indexNames );
 	}
 
     /**
@@ -127,7 +129,7 @@ public class IndexLister
 					throws StandardException
 	{
 		if ( distinctIndexRowGenerators == null ) { getAllIndexes(); }
-		return	distinctIndexRowGenerators;
+		return	(IndexRowGenerator[]) ArrayUtil.copy( distinctIndexRowGenerators );
 	}
 
     /**
@@ -142,7 +144,7 @@ public class IndexLister
 					throws StandardException
 	{
 		if ( distinctIndexConglomerateNumbers == null ) { getAllIndexes(); }
-		return	distinctIndexConglomerateNumbers;
+		return	ArrayUtil.copy( distinctIndexConglomerateNumbers );
 	}
 
     /**
@@ -156,7 +158,7 @@ public class IndexLister
     public	String[]		getDistinctIndexNames()	throws StandardException
 	{
 		if ( indexNames == null ) { getAllIndexes(); }
-		return	indexNames;
+		return	ArrayUtil.copy( indexNames );
 	}
 
 	////////////////////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PasswordHasher.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PasswordHasher.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PasswordHasher.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PasswordHasher.java
Thu Apr 25 14:57:01 2013
@@ -25,6 +25,7 @@ import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.util.StringUtil;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -107,7 +108,7 @@ public  class   PasswordHasher
          )
     {
         _messageDigestAlgorithm = messageDigestAlgorithm;
-        _salt = salt;
+        _salt = ArrayUtil.copy( salt );
         _iterations = iterations;
     }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -32,6 +32,7 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.context.ContextService;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
@@ -46,6 +47,7 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
 import org.apache.derby.iapi.store.access.TransactionController;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.DataTypeUtilities;
 
 /**
  * A SPSDescriptor describes a Stored Prepared Statement.
@@ -218,7 +220,7 @@ public class SPSDescriptor extends Tuple
 		this.text = text;
 		this.usingText = usingText;
 		this.valid = valid;
-		this.compileTime = compileTime;
+		this.compileTime = DataTypeUtilities.clone( compileTime );
 		this.sd = dataDictionary.getSchemaDescriptor(suuid, null);
 		this.preparedStatement = preparedStatement;
 		this.compSchemaId = compSchemaUUID;
@@ -510,7 +512,7 @@ public class SPSDescriptor extends Tuple
 	 */
 	public final synchronized Timestamp getCompileTime()
 	{
-		return compileTime;
+		return DataTypeUtilities.clone( compileTime );
 	}
 
 	/**
@@ -593,7 +595,7 @@ public class SPSDescriptor extends Tuple
             lookedUpParams = true;
         }
 
-		return params;
+		return (DataTypeDescriptor[]) ArrayUtil.copy( params );
 	}
 
 	/**
@@ -603,7 +605,7 @@ public class SPSDescriptor extends Tuple
 	 */
 	public final synchronized void setParams(DataTypeDescriptor params[])
 	{
-		this.params = params;
+		this.params = (DataTypeDescriptor[]) ArrayUtil.copy( params );
 	}
 
 	/**
@@ -620,9 +622,11 @@ public class SPSDescriptor extends Tuple
 		throws StandardException
 	{
 		if (paramDefaults == null)
+        {
 			getParams();
+        }
 
-		return paramDefaults;
+		return ArrayUtil.copy( paramDefaults );
 	}
 
 	/**
@@ -632,7 +636,7 @@ public class SPSDescriptor extends Tuple
 	 */
 	public final synchronized void setParameterDefaults(Object[] values)
 	{
-		this.paramDefaults = values;
+		this.paramDefaults = ArrayUtil.copy( values );
 	}
 	
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/StatisticsDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/StatisticsDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/StatisticsDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/StatisticsDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -23,6 +23,7 @@ package org.apache.derby.iapi.sql.dictio
 
 import org.apache.derby.catalog.Statistics;
 import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.types.DataTypeUtilities;
 
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import java.sql.Timestamp;
@@ -72,7 +73,7 @@ public class StatisticsDescriptor extend
 	/*----- getter functions for rowfactory ------*/
 	public UUID getTableUUID() { return statTableID;}
 	public UUID getReferenceID() { return statRefID; }
-	public Timestamp getUpdateTimestamp() { return statUpdateTime; }
+	public Timestamp getUpdateTimestamp() { return DataTypeUtilities.clone( statUpdateTime );
}
 	public String getStatType() { return statType; }
 	public boolean isValid() { return statValid; }
 	public Statistics getStatistic() { return statStat; }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -21,10 +21,12 @@
 
 package org.apache.derby.iapi.sql.dictionary;
 
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.Formatable;
 import org.apache.derby.iapi.sql.depend.Dependent;
 import org.apache.derby.iapi.sql.depend.Provider;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.types.DataTypeUtilities;
 import org.apache.derby.catalog.UUID;
 import java.sql.Timestamp;
 
@@ -188,8 +190,8 @@ public class TriggerDescriptor extends T
 		this.whenSPSId = whenSPSId;
 		this.isEnabled = isEnabled;
 		this.referencedCols = referencedCols;
-		this.referencedColsInTriggerAction = referencedColsInTriggerAction;
-		this.creationTimestamp = creationTimestamp;
+		setReferencedColsInTriggerAction( referencedColsInTriggerAction );
+		this.creationTimestamp = DataTypeUtilities.clone( creationTimestamp );
 		this.triggerDefinition = triggerDefinition;
 		this.referencingOld = referencingOld;
 		this.referencingNew = referencingNew;
@@ -274,7 +276,7 @@ public class TriggerDescriptor extends T
 	 */
 	public Timestamp getCreationTimestamp()
 	{
-		return creationTimestamp;
+		return DataTypeUtilities.clone( creationTimestamp );
 	}
 
 	/**
@@ -460,7 +462,7 @@ public class TriggerDescriptor extends T
 	 */
 	public int[] getReferencedCols()
 	{
-		return referencedCols;
+		return ArrayUtil.copy( referencedCols );
 	}
 
 	/**
@@ -470,9 +472,15 @@ public class TriggerDescriptor extends T
 	 */
 	public int[] getReferencedColsInTriggerAction()
 	{
-		return referencedColsInTriggerAction;
+        return ArrayUtil.copy( referencedColsInTriggerAction );
 	}
 
+    /** Set the referenced column array for trigger actions */
+    public  void    setReferencedColsInTriggerAction( int[] referencedColsInTriggerAction
)
+    {
+		this.referencedColsInTriggerAction = ArrayUtil.copy( referencedColsInTriggerAction );
+    }
+
 	/**
 	 * Is this trigger enabled
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/UserDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/UserDescriptor.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/UserDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/UserDescriptor.java
Thu Apr 25 14:57:01 2013
@@ -24,6 +24,8 @@ package org.apache.derby.iapi.sql.dictio
 import java.sql.Timestamp;
 import java.util.Arrays;
 
+import org.apache.derby.iapi.types.DataTypeUtilities;
+
 /**
  * A Descriptor for a user stored in SYSUSERS.
  */
@@ -65,12 +67,12 @@ public final class  UserDescriptor exten
             System.arraycopy( password, 0, _password, 0, password.length );
         }
         
-        _lastModified = lastModified;
+        _lastModified = DataTypeUtilities.clone( lastModified );
 	}
 
 	public String getUserName(){ return _userName; }
 	public String getHashingScheme()    { return _hashingScheme; }
-    public  Timestamp   getLastModified()   { return _lastModified; }
+    public  Timestamp   getLastModified()   { return DataTypeUtilities.clone( _lastModified
); }
 
     /**
      * <p>

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java Thu
Apr 25 14:57:01 2013
@@ -27,6 +27,7 @@ import org.apache.derby.iapi.reference.J
 import org.apache.derby.iapi.reference.JDBC40Translation;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
+import java.sql.Timestamp;
 import java.sql.Types;
 import java.sql.ResultSetMetaData;
 
@@ -35,6 +36,12 @@ import java.sql.ResultSetMetaData;
  */
 public abstract class DataTypeUtilities  {
 
+    /** Clone a Timestamp because they are mutable */
+    public  static  Timestamp   clone( Timestamp original )
+    {
+        return original == null ? null : (Timestamp) original.clone();
+    }
+    
 	/**
 		Get the precision of the datatype.
 		@param	dtd			data type descriptor

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Thu Apr 25 14:57:01 2013
@@ -1551,6 +1551,7 @@ class AlterTableConstantAction extends D
 						if (referencedColsInTriggerAction[j] > droppedColumnPosition)
 							referencedColsInTriggerAction[j]--;
 					}
+                    trd.setReferencedColsInTriggerAction( referencedColsInTriggerAction );
 					dd.addDescriptor(trd, sd,
 							 DataDictionary.SYSTRIGGERS_CATALOG_NUM,
 							 false, tc);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java?rev=1475809&r1=1475808&r2=1475809&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java
Thu Apr 25 14:57:01 2013
@@ -33,6 +33,7 @@ import org.apache.derby.iapi.services.io
 
 import org.apache.derby.iapi.sql.execute.RunTimeStatistics;
 import org.apache.derby.iapi.sql.execute.xplain.XPLAINVisitor;
+import org.apache.derby.iapi.types.DataTypeUtilities;
 
 import java.util.Vector;
 
@@ -98,14 +99,10 @@ public final class RunTimeStatisticsImpl
 		this.optimizeTime = optimizeTime;
 		this.generateTime = generateTime;
 		this.executeTime = executeTime;
-		this.beginCompilationTimestamp =beginCompilationTimestamp == null ?
-            null : (Timestamp) beginCompilationTimestamp.clone();
-		this.endCompilationTimestamp = endCompilationTimestamp == null ?
-            null : (Timestamp) endCompilationTimestamp.clone();
-		this.beginExecutionTimestamp = beginExecutionTimestamp == null ?
-            null : (Timestamp) beginExecutionTimestamp.clone();
-		this.endExecutionTimestamp = endExecutionTimestamp == null ?
-            null : (Timestamp) endExecutionTimestamp.clone();
+		this.beginCompilationTimestamp = DataTypeUtilities.clone( beginCompilationTimestamp );
+		this.endCompilationTimestamp = DataTypeUtilities.clone( endCompilationTimestamp );
+		this.beginExecutionTimestamp = DataTypeUtilities.clone( beginExecutionTimestamp );
+		this.endExecutionTimestamp = DataTypeUtilities.clone( endExecutionTimestamp );
 		this.subqueryTrackingArray = (ResultSetStatistics[]) ArrayUtil.copy( subqueryTrackingArray
);
 		this.topResultSetStatistics = topResultSetStatistics;
 	}
@@ -179,7 +176,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getBeginCompilationTimestamp()
 	{
-		return beginCompilationTimestamp == null ?  null : (Timestamp) beginCompilationTimestamp.clone();
+		return DataTypeUtilities.clone( beginCompilationTimestamp );
 	}
 
 	/**
@@ -189,7 +186,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getEndCompilationTimestamp()
 	{
-		return endCompilationTimestamp == null ? null : (Timestamp) endCompilationTimestamp.clone();
+		return DataTypeUtilities.clone( endCompilationTimestamp );
 	}
 
 	/**
@@ -199,7 +196,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getBeginExecutionTimestamp()
 	{
-		return beginExecutionTimestamp == null ? null : (Timestamp) beginExecutionTimestamp.clone();
+		return DataTypeUtilities.clone( beginExecutionTimestamp );
 	}
 
 	/**
@@ -209,7 +206,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getEndExecutionTimestamp()
 	{
-		return endExecutionTimestamp == null ? null : (Timestamp) endExecutionTimestamp.clone();
+		return DataTypeUtilities.clone( endExecutionTimestamp );
 	}
 
 	/**



Mime
View raw message