Skip to content

Commit

Permalink
Changed to require non null for Locale
Browse files Browse the repository at this point in the history
  • Loading branch information
normanj-bitquill committed Sep 16, 2024
1 parent db306d1 commit b565b49
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4404,7 +4404,7 @@ public String toChar(long timestamp, String pattern) {

public static String toCharPg(DataContext root, long timestamp, String pattern) {
final ZoneId zoneId = DataContext.Variable.TIME_ZONE.<TimeZone>get(root).toZoneId();
final Locale locale = DataContext.Variable.LOCALE.get(root);
final Locale locale = requireNonNull(DataContext.Variable.LOCALE.get(root));
final Timestamp sqlTimestamp = internalToTimestamp(timestamp);
final ZonedDateTime zonedDateTime =
ZonedDateTime.of(sqlTimestamp.toLocalDateTime(), zoneId);
Expand All @@ -4418,7 +4418,7 @@ public int toDate(String dateString, String fmtString) {

public static int toDatePg(DataContext root, String dateString, String fmtString) {
try {
final Locale locale = DataContext.Variable.LOCALE.get(root);
final Locale locale = requireNonNull(DataContext.Variable.LOCALE.get(root));
return (int) PostgresqlDateTimeFormatter.toTimestamp(dateString, fmtString, LOCAL_ZONE,
locale)
.getLong(ChronoField.EPOCH_DAY);
Expand All @@ -4439,7 +4439,7 @@ public long toTimestamp(String timestampString, String fmtString) {

public static long toTimestampPg(DataContext root, String timestampString, String fmtString) {
try {
final Locale locale = DataContext.Variable.LOCALE.get(root);
final Locale locale = requireNonNull(DataContext.Variable.LOCALE.get(root));
return PostgresqlDateTimeFormatter.toTimestamp(timestampString, fmtString, LOCAL_ZONE,
locale)
.toInstant().toEpochMilli();
Expand Down

0 comments on commit b565b49

Please sign in to comment.