Skip to content

Commit 97f040a

Browse files
author
Jörg Hälker
committed
Updated FIX for rico-projects#43
1 parent b3fe164 commit 97f040a

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

remoting/rico-remoting-common/src/main/java/dev/rico/internal/remoting/converters/InstantConverterFactory.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright 2018-2019 Karakun AG.
23
* Copyright 2015-2016 Canoo Engineering AG.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,14 +27,15 @@
2627

2728
/**
2829
* Created by hendrikebbers on 25.10.16.
30+
* Adopted by Jörg Hälker on 29.01.18.
2931
*/
3032
public class InstantConverterFactory extends AbstractConverterFactory {
3133

3234
@SuppressWarnings("rawtypes")
3335
private final static Converter CONVERTER = new InstantConverter();
3436

3537
@Override
36-
public boolean supportsType(Class<?> cls) {
38+
public boolean supportsType(final Class<?> cls) {
3739
return Instant.class.isAssignableFrom(cls);
3840
}
3941

@@ -48,14 +50,14 @@ public int getTypeIdentifier() {
4850
}
4951

5052
@Override
51-
public Converter getConverterForType(Class<?> cls) {
53+
public Converter getConverterForType(final Class<?> cls) {
5254
return CONVERTER;
5355
}
5456

5557
private static class InstantConverter extends AbstractStringConverter<Instant> {
5658

5759
@Override
58-
public Instant convertFromRemoting(String value) throws ValueConverterException {
60+
public Instant convertFromRemoting(final String value) throws ValueConverterException {
5961
if (value == null) {
6062
return null;
6163
}
@@ -67,7 +69,7 @@ public Instant convertFromRemoting(String value) throws ValueConverterException
6769
}
6870

6971
@Override
70-
public String convertToRemoting(Instant value) throws ValueConverterException {
72+
public String convertToRemoting(final Instant value) throws ValueConverterException {
7173
if (value == null) {
7274
return null;
7375
}

remoting/rico-remoting-common/src/main/java/dev/rico/internal/remoting/converters/LocalDateConverterFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ public int getTypeIdentifier() {
5454
private static class LocalDateConverter
5555
extends AbstractDateConverter<LocalDate> {
5656

57+
private static final String UTC = "UTC";
58+
5759
@Override
5860
public LocalDate convertFromRemoting(final String value)
5961
throws ValueConverterException {
6062
if (value == null) {
6163
return null;
6264
}
6365
try {
64-
final Calendar result = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
66+
final Calendar result = Calendar.getInstance(TimeZone.getTimeZone(UTC));
6567
result.setTime(getDateFormat().parse(value));
6668
return result.toInstant().atZone(ZoneOffset.UTC).toLocalDate();
6769
} catch (final Exception e) {

remoting/rico-remoting-common/src/main/java/dev/rico/internal/remoting/converters/LocalTimeConverterFactory.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright 2018-2019 Karakun AG.
23
* Copyright 2015-2016 Canoo Engineering AG.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,14 +27,15 @@
2627

2728
/**
2829
* Created by hendrikebbers on 25.10.16.
30+
* Adopted by Jörg Hälker on 29.01.18.
2931
*/
3032
public class LocalTimeConverterFactory extends AbstractConverterFactory {
3133

3234
@SuppressWarnings("rawtypes")
3335
private final static Converter CONVERTER = new LocalTimeConverter();
3436

3537
@Override
36-
public boolean supportsType(Class<?> cls) {
38+
public boolean supportsType(final Class<?> cls) {
3739
return LocalTime.class.isAssignableFrom(cls);
3840
}
3941

@@ -48,14 +50,14 @@ public int getTypeIdentifier() {
4850
}
4951

5052
@Override
51-
public Converter getConverterForType(Class<?> cls) {
53+
public Converter getConverterForType(final Class<?> cls) {
5254
return CONVERTER;
5355
}
5456

5557
private static class LocalTimeConverter extends AbstractStringConverter<LocalTime> {
5658

5759
@Override
58-
public LocalTime convertFromRemoting(String value) throws ValueConverterException {
60+
public LocalTime convertFromRemoting(final String value) throws ValueConverterException {
5961
if (value == null) {
6062
return null;
6163
}
@@ -67,7 +69,7 @@ public LocalTime convertFromRemoting(String value) throws ValueConverterExceptio
6769
}
6870

6971
@Override
70-
public String convertToRemoting(LocalTime value) throws ValueConverterException {
72+
public String convertToRemoting(final LocalTime value) throws ValueConverterException {
7173
if (value == null) {
7274
return null;
7375
}

0 commit comments

Comments
 (0)