Updated Branches: refs/heads/master 12cb5670a -> 8f52e1229
TAP5-1926: PropertyDisplayBlocks Date's display block is not thread safe Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/8f52e122 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/8f52e122 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/8f52e122 Branch: refs/heads/master Commit: 8f52e12293896d7446655c5bd80fc5da11a306da Parents: 12cb567 Author: Howard M. Lewis Ship <[email protected]> Authored: Thu Jul 25 12:55:24 2013 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Thu Jul 25 12:55:24 2013 -0700 ---------------------------------------------------------------------- .../corelib/pages/PropertyDisplayBlocks.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8f52e122/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java index 487457a..92c72b6 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java @@ -1,4 +1,4 @@ -// Copyright 2007, 2008, 2010 The Apache Software Foundation +// Copyright 2007, 2008, 2010, 2013 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,8 +39,6 @@ public class PropertyDisplayBlocks @Inject private Locale locale; - private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); - public String getConvertedEnumValue() { Enum value = (Enum) context.getPropertyValue(); @@ -52,18 +50,15 @@ public class PropertyDisplayBlocks public DateFormat getDateFormat() { - return dateFormat; + return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); } - - public Date getCalendarDate() + + public Date getCalendarDate() { Calendar calendar = (Calendar) context.getPropertyValue(); - - if(calendar == null) - return null; - - return calendar.getTime(); - } + + return calendar == null ? null : calendar.getTime(); + } public PropertyOutputContext getContext()
