8210142: java.util.Calendar.clone() doesn't respect sharedZone flag

Reviewed-by: rriggs
This commit is contained in:
Naoto Sato 2018-09-06 10:49:17 -07:00
parent 9d6230fe4e
commit d1958eeed1
2 changed files with 31 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3326,7 +3326,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
other.stamp[i] = stamp[i];
other.isSet[i] = isSet[i];
}
other.zone = (TimeZone) zone.clone();
if (!sharedZone) {
other.zone = (TimeZone) zone.clone();
}
return other;
}
catch (CloneNotSupportedException e) {