< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2004, 2020, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 30,39 **** --- 30,40 ---- import java.io.ObjectInputStream; import java.io.Serializable; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; + import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone;
*** 188,198 **** * @author Kohsuke Kawaguchi * @author Joseph Fialli * @author Sunitha Reddy * @see javax.xml.datatype.Duration * @since 1.5 ! * @LastModified: June 2018 */ public class XMLGregorianCalendarImpl extends XMLGregorianCalendar implements Serializable, Cloneable { --- 189,199 ---- * @author Kohsuke Kawaguchi * @author Joseph Fialli * @author Sunitha Reddy * @see javax.xml.datatype.Duration * @since 1.5 ! * @LastModified: Aug 2020 */ public class XMLGregorianCalendarImpl extends XMLGregorianCalendar implements Serializable, Cloneable {
*** 1704,1729 **** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { ! ! // Following two dates compare to EQUALS since in different timezones. ! // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 ! // ! // Must ensure both instances generate same hashcode by normalizing ! // this to UTC timezone. ! int timezone = getTimezone(); ! if (timezone == DatatypeConstants.FIELD_UNDEFINED) { ! timezone = 0; ! } ! XMLGregorianCalendar gc = this; ! if (timezone != 0) { ! gc = this.normalizeToTimezone(getTimezone()); ! } ! return gc.getYear() + gc.getMonth() + gc.getDay() + ! gc.getHour() + gc.getMinute() + gc.getSecond(); } /** * <p>Constructs a new XMLGregorianCalendar object by --- 1705,1715 ---- * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { ! return super.hashCode(); } /** * <p>Constructs a new XMLGregorianCalendar object by
< prev index next >