Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EADB10FA0 for ; Tue, 25 Mar 2014 19:56:38 +0000 (UTC) Received: (qmail 10998 invoked by uid 500); 25 Mar 2014 19:56:37 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 10958 invoked by uid 500); 25 Mar 2014 19:56:37 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 10946 invoked by uid 99); 25 Mar 2014 19:56:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 19:56:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 10752923386; Tue, 25 Mar 2014 19:56:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mdrob@apache.org To: commits@accumulo.apache.org Date: Tue, 25 Mar 2014 19:56:34 -0000 Message-Id: <7cb404d640704bef815e7b42efb992a9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: ACCUMULO-2503 fix time zone assertion Repository: accumulo Updated Branches: refs/heads/1.6.0-SNAPSHOT 1c5161933 -> 55b17e476 refs/heads/master 8291b6ce1 -> 39e09cbc0 ACCUMULO-2503 fix time zone assertion Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/55b17e47 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/55b17e47 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/55b17e47 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 55b17e476686e846cdfd519393ef506e8a35a234 Parents: 1c51619 Author: Mike Drob Authored: Tue Mar 25 15:51:40 2014 -0400 Committer: Mike Drob Committed: Tue Mar 25 15:55:56 2014 -0400 ---------------------------------------------------------------------- .../apache/accumulo/core/util/format/DateStringFormatter.java | 6 ++++++ .../accumulo/core/util/format/DateStringFormatterTest.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/55b17e47/core/src/main/java/org/apache/accumulo/core/util/format/DateStringFormatter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/util/format/DateStringFormatter.java b/core/src/main/java/org/apache/accumulo/core/util/format/DateStringFormatter.java index 9a7febc..037ddb0 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/format/DateStringFormatter.java +++ b/core/src/main/java/org/apache/accumulo/core/util/format/DateStringFormatter.java @@ -19,6 +19,7 @@ package org.apache.accumulo.core.util.format; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Map.Entry; +import java.util.TimeZone; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; @@ -26,6 +27,7 @@ import org.apache.accumulo.core.data.Value; public class DateStringFormatter implements Formatter { private boolean printTimestamps = false; private DefaultFormatter defaultFormatter = new DefaultFormatter(); + public static final String DATE_FORMAT = "yyyy/MM/dd HH:mm:ss.SSS"; // SimpleDataFormat is not thread safe private static final ThreadLocal formatter = new ThreadLocal() { @@ -58,4 +60,8 @@ public class DateStringFormatter implements Formatter { public void remove() { defaultFormatter.remove(); } + + public void setTimeZone(TimeZone zone) { + formatter.get().setTimeZone(zone); + } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/55b17e47/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java index 69b2e11..1b121f3 100644 --- a/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java +++ b/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.Map; +import java.util.TimeZone; import java.util.TreeMap; import org.apache.accumulo.core.data.Key; @@ -42,9 +43,10 @@ public class DateStringFormatterTest { @Test public void testTimestamps() { formatter.initialize(data.entrySet(), true); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); assertTrue(formatter.hasNext()); - assertTrue(formatter.next().endsWith("1969/12/31 19:00:00.000")); + assertTrue(formatter.next().endsWith("1970/01/01 00:00:00.000")); } @Test