File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
src/main/java/dev/luismachadoreis/flighttracker/server/ping/domain Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 99
1010import java .time .Instant ;
1111import java .util .UUID ;
12+ import java .util .Arrays ;
1213
1314@ Entity
1415@ Getter
@@ -160,17 +161,27 @@ public record Position(
160161 public static class IntegerArrayConverter implements AttributeConverter <Integer [], String > {
161162 @ Override
162163 public String convertToDatabaseColumn (Integer [] attribute ) {
163- if (attribute == null ) return "" ;
164- return String .join ("," , java .util .Arrays .stream (attribute )
164+ if (attribute == null ) {
165+ return null ;
166+ }
167+ if (attribute .length == 0 ) {
168+ return "" ;
169+ }
170+ return String .join ("," , Arrays .stream (attribute )
165171 .map (String ::valueOf )
166172 .toArray (String []::new ));
167173 }
168174
169175 @ Override
170176 public Integer [] convertToEntityAttribute (String dbData ) {
171- if (dbData == null || dbData .isEmpty ()) return new Integer [0 ];
172- return java .util .Arrays .stream (dbData .split ("," ))
173- .map (Integer ::valueOf )
177+ if (dbData == null ) {
178+ return null ;
179+ }
180+ if (dbData .isEmpty ()) {
181+ return new Integer [0 ];
182+ }
183+ return Arrays .stream (dbData .split ("," ))
184+ .map (Integer ::parseInt )
174185 .toArray (Integer []::new );
175186 }
176187 }
You can’t perform that action at this time.
0 commit comments