You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2011/03/04 18:15:00 UTC

Re: svn commit: r1077934 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java

On 4 March 2011 13:30,  <sc...@apache.org> wrote:
> Author: scolebourne
> Date: Fri Mar  4 13:30:35 2011
> New Revision: 1077934
>
> URL: http://svn.apache.org/viewvc?rev=1077934&view=rev
> Log:
> Document mutability of UTC constant, which isn't ideal
>
> Modified:
>    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java
>
> Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java
> URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java?rev=1077934&r1=1077933&r2=1077934&view=diff
> ==============================================================================
> --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java (original)
> +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java Fri Mar  4 13:30:35 2011
> @@ -54,6 +54,8 @@ public class DateUtils {
>
>     /**
>      * The UTC time zone (often referred to as GMT).
> +     * Since a {@code TimeZone} is mutable and this is a "constant", it is
> +     * essential that this object is not altered.
>      */
>     public static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone("GMT");
>     /**

AFAICT, it's not used within Lang3 - so why don't we just delete it ?

Does it really offer much benefit, given the drawback of malicious or
accidental corruption?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1077934 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java

Posted by Henri Yandell <fl...@gmail.com>.
On Fri, Mar 4, 2011 at 9:19 AM, Stephen Colebourne <sc...@joda.org> wrote:
> On 4 March 2011 17:15, sebb <se...@gmail.com> wrote:
>> On 4 March 2011 13:30,  <sc...@apache.org> wrote:
>>> Log:
>>> Document mutability of UTC constant, which isn't ideal
>
>> AFAICT, it's not used within Lang3 - so why don't we just delete it ?
>>
>> Does it really offer much benefit, given the drawback of malicious or
>> accidental corruption?
>
> I'm strongly in favour of replacing this with either removing it or
> adding a static method that creates a new instance each time it is
> called.

+1.

I'm all for removing things. I don't see much harm from making this a
static method that creates a new instance though, I can see the vague
value in the feature.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1077934 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java

Posted by sebb <se...@gmail.com>.
On 4 March 2011 17:19, Stephen Colebourne <sc...@joda.org> wrote:
> On 4 March 2011 17:15, sebb <se...@gmail.com> wrote:
>> On 4 March 2011 13:30,  <sc...@apache.org> wrote:
>>> Log:
>>> Document mutability of UTC constant, which isn't ideal
>
>> AFAICT, it's not used within Lang3 - so why don't we just delete it ?
>>
>> Does it really offer much benefit, given the drawback of malicious or
>> accidental corruption?
>
> I'm strongly in favour of replacing this with either removing it or
> adding a static method that creates a new instance each time it is
> called.

Or perhaps replace it with a String constant

/**
* The UTC time zone id (often referred to as GMT).
* Usage: TimeZone.getTimeZone(UTC_TIME_ZONE_ID);
*/
public static final String UTC_TIME_ZONE_ID = "GMT" ;-)


> Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1077934 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java

Posted by Stephen Colebourne <sc...@joda.org>.
On 4 March 2011 17:15, sebb <se...@gmail.com> wrote:
> On 4 March 2011 13:30,  <sc...@apache.org> wrote:
>> Log:
>> Document mutability of UTC constant, which isn't ideal

> AFAICT, it's not used within Lang3 - so why don't we just delete it ?
>
> Does it really offer much benefit, given the drawback of malicious or
> accidental corruption?

I'm strongly in favour of replacing this with either removing it or
adding a static method that creates a new instance each time it is
called.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org