< prev index next >
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * 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,10 +30,11 @@
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,11 +189,11 @@
* @author Kohsuke Kawaguchi
* @author Joseph Fialli
* @author Sunitha Reddy
* @see javax.xml.datatype.Duration
* @since 1.5
- * @LastModified: June 2018
+ * @LastModified: Aug 2020
*/
public class XMLGregorianCalendarImpl
extends XMLGregorianCalendar
implements Serializable, Cloneable {
@@ -1718,12 +1719,14 @@
}
XMLGregorianCalendar gc = this;
if (timezone != 0) {
gc = this.normalizeToTimezone(getTimezone());
}
- return gc.getYear() + gc.getMonth() + gc.getDay() +
- gc.getHour() + gc.getMinute() + gc.getSecond();
+
+ int[] elements = {gc.getYear(), gc.getMonth(), gc.getDay(), gc.getHour(),
+ gc.getMinute(), gc.getSecond(), gc.getMillisecond()};
+ return Arrays.hashCode(elements);
}
/**
* <p>Constructs a new XMLGregorianCalendar object by
< prev index next >