db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r988874 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/util/ engine/org/apache/derby/impl/services/locks/ engine/org/apache/derby/impl/services/monitor/ engine/org/apache/derby/impl/services/st...
Date Wed, 25 Aug 2010 08:22:25 GMT
Author: kahatlen
Date: Wed Aug 25 08:22:24 2010
New Revision: 988874

URL: http://svn.apache.org/viewvc?rev=988874&view=rev
Log:
DERBY-4752: CheapDateFormatter returns incorrect and invalid date strings

Removed the CheapDateFormatter class and made the code use
java.util.Date and its toString() method instead.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties
  (with props)
Removed:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/CheapDateFormatter.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/CheapDateFormatterTest.java
Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Timeout.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/stream/BasicGetLogHeader.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Wed Aug 25 08:22:24 2010
@@ -53,6 +53,7 @@ import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Properties;
@@ -78,13 +79,11 @@ import org.apache.derby.iapi.services.pr
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.tools.i18n.LocalizedOutput;
 import org.apache.derby.iapi.tools.i18n.LocalizedResource;
-import org.apache.derby.iapi.util.CheapDateFormatter;
 import org.apache.derby.iapi.util.StringUtil;
 import org.apache.derby.impl.jdbc.EmbedSQLException;
 import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.iapi.jdbc.AuthenticationService;
 import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.security.SecurityUtil;
 import org.apache.derby.mbeans.VersionMBean;
 import org.apache.derby.mbeans.drda.NetworkServerMBean;
 
@@ -604,7 +603,7 @@ public final class NetworkServerControlI
 		{
 			synchronized(lw) {
                 if (printTimeStamp) {
-                    lw.println(getFormattedTimestamp() + " : " + msg);
+                    lw.println(new Date() + " : " + msg);
                 } else {
                     lw.println(msg);                    
                 }
@@ -616,7 +615,7 @@ public final class NetworkServerControlI
 			synchronized(lw)
 			{
 				if (printTimeStamp) {
-                    Monitor.logMessage(getFormattedTimestamp() + " : " + msg);
+                    Monitor.logMessage(new Date() + " : " + msg);
                 } else {
                     Monitor.logMessage(msg);
                 }
@@ -4061,23 +4060,4 @@ public final class NetworkServerControlI
 		}
 		return myPVH;
 	}
-
-	/**
-	 * This method returns a timestamp to be used in the messages. 
-	 * CheapDateFormatter class, which uses GMT, is used to format timestamps. 
-	 * This is to keep the formatting consistent with Derby boot message since
-	 * network server messages and the boot message get written to derby.log.   
-	 * 
-	 * @return current timestamp formatted in GMT
-	 */
-	private String getFormattedTimestamp(){
-		long currentTime = System.currentTimeMillis();
-		return CheapDateFormatter.formatDate(currentTime);
-	}
 }
-
-
-
-
-
-

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Timeout.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Timeout.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Timeout.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Timeout.java Wed
Aug 25 08:22:24 2010
@@ -21,8 +21,6 @@
 
 package org.apache.derby.impl.services.locks;
 
-import org.apache.derby.impl.services.locks.TableNameInfo;
-
 import org.apache.derby.iapi.services.context.ContextService;
 
 import org.apache.derby.iapi.reference.SQLState;
@@ -36,8 +34,7 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.store.access.TransactionController;
 
-import org.apache.derby.iapi.util.CheapDateFormatter;
-
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
@@ -176,7 +173,7 @@ public final class Timeout
         }
 
         sb.append( newline );
-        sb.append(CheapDateFormatter.formatDate(currentTime));
+        sb.append(new Date(currentTime));
         sb.append( newline );
         for( i = 0; i < column.length; i++ )
         {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
Wed Aug 25 08:22:24 2010
@@ -58,22 +58,14 @@ import org.apache.derby.iapi.services.lo
 import org.apache.derby.iapi.services.io.FormatableInstanceGetter;
 import org.apache.derby.iapi.error.ExceptionSeverity;
 
-
 import  org.apache.derby.io.StorageFactory;
 
-
 import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.i18n.BundleFinder;
 import org.apache.derby.iapi.services.i18n.MessageService;
-import org.apache.derby.iapi.services.jmx.ManagementService;
-
-import org.apache.derby.impl.services.monitor.StorageFactoryService;
-
-import org.apache.derby.iapi.util.CheapDateFormatter;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.StringWriter;
 import java.io.BufferedInputStream;
 import java.io.PrintWriter;
 import java.io.BufferedReader;
@@ -82,10 +74,8 @@ import java.io.ByteArrayInputStream;
 import java.io.PrintStream;
 
 import java.util.Collections;
-import java.util.Hashtable;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Enumeration;
 import java.util.StringTokenizer;
@@ -94,14 +84,10 @@ import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.NoSuchElementException;
 
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.InvocationTargetException;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
 
 import java.net.URL;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/stream/BasicGetLogHeader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/stream/BasicGetLogHeader.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/stream/BasicGetLogHeader.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/stream/BasicGetLogHeader.java
Wed Aug 25 08:22:24 2010
@@ -21,8 +21,8 @@
 
 package org.apache.derby.impl.services.stream;
 
+import java.util.Date;
 import org.apache.derby.iapi.services.stream.PrintWriterGetHeader;
-import org.apache.derby.iapi.util.CheapDateFormatter;
 
 /**
  * Get a header to prepend to a line of output. *
@@ -74,12 +74,10 @@ class BasicGetLogHeader implements Print
 		}
 
 		if (doTimeStamp) {
-			long currentTime = System.currentTimeMillis();
-
-			header.append(CheapDateFormatter.formatDate(currentTime));
+			header.append(new Date());
 			header.append(' ');
-
 		}
+
 		if (doThreadId) {
 			header.append(Thread.currentThread().toString());
 			header.append(' ');

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Wed Aug 25 08:22:24 2010
@@ -24,15 +24,6 @@ package org.apache.derby.impl.store.raw.
 
 import org.apache.derby.iapi.reference.MessageId;
 
-import org.apache.derby.impl.store.raw.data.AllocationActions;
-import org.apache.derby.impl.store.raw.data.BaseContainerHandle;
-import org.apache.derby.impl.store.raw.data.BasePage;
-import org.apache.derby.impl.store.raw.data.DirectActions;
-import org.apache.derby.impl.store.raw.data.LoggableActions;
-import org.apache.derby.impl.store.raw.data.PageActions;
-import org.apache.derby.impl.store.raw.data.RecordId;
-import org.apache.derby.impl.store.raw.data.ReclaimSpace;
-
 import org.apache.derby.iapi.services.info.ProductVersionHolder;
 
 import org.apache.derby.iapi.services.cache.CacheFactory;
@@ -81,20 +72,18 @@ import org.apache.derby.iapi.reference.P
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.util.ByteArray;
 import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.derby.iapi.util.CheapDateFormatter;
 import org.apache.derby.iapi.util.ReuseFactory;
 import org.apache.derby.iapi.services.property.PropertyUtil;
 
+import java.util.Date;
 import java.util.Properties;
 import java.util.Hashtable;
 import java.util.Enumeration;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 
 import java.net.URL;
-import java.net.URLDecoder;
 
 import java.security.AccessController;
 import java.security.CodeSource;
@@ -363,13 +352,12 @@ public class BaseDataFileFactory
 		}
 
 		logMsg(LINE);
-		long bootTime = System.currentTimeMillis();
         String readOnlyMsg = (isReadOnly()) 
             ? MessageService.getTextMessage(MessageId.STORE_BOOT_READONLY_MSG)
             : "";
         boolean logBootTrace = Boolean.valueOf(startParams.getProperty(Property.LOG_BOOT_TRACE,
                PropertyUtil.getSystemProperty(Property.LOG_BOOT_TRACE))).booleanValue();
-		logMsg(CheapDateFormatter.formatDate(bootTime) +
+        logMsg(new Date() +
 			   MessageService.getTextMessage(MessageId.STORE_BOOT_MSG,
                                              jbmsVersion,
                                              identifier,
@@ -479,9 +467,8 @@ public class BaseDataFileFactory
 				rawStoreDaemon.stop();
 		}
 
-		long shutdownTime = System.currentTimeMillis();
 		boolean logBootTrace = PropertyUtil.getSystemBoolean(Property.LOG_BOOT_TRACE);
-		logMsg("\n" + CheapDateFormatter.formatDate(shutdownTime) +
+		logMsg("\n" + new Date() +
                 MessageService.getTextMessage(
                     MessageId.STORE_SHUTDOWN_MSG,
                     getIdentifier(),

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
Wed Aug 25 08:22:24 2010
@@ -26,7 +26,6 @@ dblook:
  	 will be written.
  		If not specified, default is the console. 
 server:
-xxxxxxFILTERED-TIMESTAMPxxxxxGMT : No command given.
 Usage: NetworkServerControl <commands> 
 Commands:
 start [-h <host>] [-p <portnumber>] [-noSecurityManager] [-ssl <sslmode>]

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties?rev=988874&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties
Wed Aug 25 08:22:24 2010
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Filters and substitutes for SED
+
+# The first line from "java -jar derbyrun.jar server" contains a
+# timestamp that will change between runs. Remove that line.
+delete=^.* [0-9][0-9][0-9][0-9] : No command given.$

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest_sed.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java?rev=988874&r1=988873&r2=988874&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java Wed
Aug 25 08:22:24 2010
@@ -47,7 +47,6 @@ public class _Suite extends BaseTestCase
         TestSuite suite = new TestSuite("JUnit unit tests");
 
         suite.addTest(ArrayInputStreamTest.suite());
-        suite.addTest(CheapDateFormatterTest.suite());
         suite.addTest(FormatableBitSetTest.suite());
         suite.addTest(SystemPrivilegesPermissionTest.suite());
         suite.addTest(UTF8UtilTest.suite());



Mime
View raw message