Skip to content

Commit

Permalink
FIX performance java.util.TimeZone.getTimeZone(TimeZone.java:516) is …
Browse files Browse the repository at this point in the history
…synchronized (#318)

* FIX performance java.util.TimeZone.getTimeZone(TimeZone.java:516) is
synchronized
* workaround java.time.DateTimeException: Invalid ID for offset-based
ZoneId: GMT+2359
  • Loading branch information
vharseko authored Jan 9, 2024
1 parent 4a74574 commit ab9e136
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.forgerock.opendj.ldap;

import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
Expand All @@ -25,6 +26,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.util.Reject;


import static com.forgerock.opendj.ldap.CoreMessages.*;

/**
Expand Down Expand Up @@ -790,7 +792,11 @@ private static TimeZone getTimeZoneForOffset(final String value, final int start

// If we've gotten here, then it looks like a valid offset. We can
// create a time zone by using "GMT" followed by the offset.
return TimeZone.getTimeZone("GMT" + offSetStr);
try {
return TimeZone.getTimeZone(ZoneId.of("GMT"+offSetStr));
}catch (java.time.DateTimeException e) {
return TimeZone.getTimeZone("GMT"+offSetStr);
}
}

/** Lazily constructed internal representations. */
Expand Down

0 comments on commit ab9e136

Please sign in to comment.