Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit 844f760

Browse files
author
shubay
committed
Add a message to the IllegalArgumentException thrown when a
DateValue/DateTimeValue/TimeOfDayValue is created with a GregorianCalendar that is not GMT.
1 parent 4146e2f commit 844f760

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/main/java/com/google/visualization/datasource/datatable/value/DateTimeValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public DateTimeValue(int year, int month, int dayOfMonth, int hours,
123123
*/
124124
public DateTimeValue(GregorianCalendar calendar) {
125125
if (!calendar.getTimeZone().equals(TimeZone.getTimeZone("GMT"))) {
126-
throw new IllegalArgumentException();
126+
throw new IllegalArgumentException(
127+
"Can't create DateTimeValue from GregorianCalendar that is not GMT.");
127128
}
128129
this.calendar = (GregorianCalendar) calendar.clone();
129130
}

src/main/java/com/google/visualization/datasource/datatable/value/DateValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ public DateValue(int year, int month, int dayOfMonth) {
124124
*/
125125
public DateValue(GregorianCalendar calendar) {
126126
if (!calendar.getTimeZone().equals(TimeZone.getTimeZone("GMT"))) {
127-
throw new IllegalArgumentException();
127+
throw new IllegalArgumentException(
128+
"Can't create DateValue from GregorianCalendar that is not GMT.");
128129
}
129130
this.year = calendar.get(GregorianCalendar.YEAR);
130131
this.month = calendar.get(GregorianCalendar.MONTH);

src/main/java/com/google/visualization/datasource/datatable/value/TimeOfDayValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public TimeOfDayValue(int hours, int minutes, int seconds, int milliseconds) {
143143
*/
144144
public TimeOfDayValue(GregorianCalendar calendar) {
145145
if (!calendar.getTimeZone().equals(TimeZone.getTimeZone("GMT"))) {
146-
throw new IllegalArgumentException();
146+
throw new IllegalArgumentException(
147+
"Can't create TimeOfDayValue from GregorianCalendar that is not GMT.");
147148
}
148149
this.hours = calendar.get(GregorianCalendar.HOUR_OF_DAY);
149150
this.minutes = calendar.get(GregorianCalendar.MINUTE);

0 commit comments

Comments
 (0)