olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [olingo-odata2] 01/01: [OLINGO-1349] Get TZ only once
Date Wed, 24 Apr 2019 19:48:17 GMT
This is an automated email from the ASF dual-hosted git repository.

mibo pushed a commit to branch OLINGO-1349
in repository https://gitbox.apache.org/repos/asf/olingo-odata2.git

commit c624d19067c0cd07d60901793d85b34cf2b53426
Author: mibo <mibo@apache.org>
AuthorDate: Wed Apr 24 21:48:09 2019 +0200

    [OLINGO-1349] Get TZ only once
---
 .../src/main/java/org/apache/olingo/odata2/core/edm/EdmTime.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/EdmTime.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/EdmTime.java
index fc99d6a..22f3cc8 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/EdmTime.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/EdmTime.java
@@ -43,6 +43,7 @@ public class EdmTime extends AbstractSimpleType {
   private static final Pattern PATTERN = Pattern.compile(
       "PT(?:(\\p{Digit}{1,2})H)?(?:(\\p{Digit}{1,4})M)?(?:(\\p{Digit}{1,5})(?:\\.(\\p{Digit}+?)0*)?S)?");
   private static final EdmTime instance = new EdmTime();
+  private static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
 
   public static EdmTime getInstance() {
     return instance;
@@ -129,7 +130,7 @@ public class EdmTime extends AbstractSimpleType {
     } else if (value instanceof Calendar) {
       dateTimeValue = (Calendar) ((Calendar) value).clone();
     } else if (value instanceof Long) {
-      dateTimeValue = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+      dateTimeValue = Calendar.getInstance(TIME_ZONE_GMT);
       dateTimeValue.clear();
       dateTimeValue.setTimeInMillis((Long) value);
     } else {


Mime
View raw message