@@ -25,7 +25,7 @@ boolean doCanDecode(PostgresqlObjectId type, Format format) {
25
25
Assert .requireNonNull (type , "type must not be null" );
26
26
Assert .requireNonNull (format , "format must not be null" );
27
27
28
- return POINT == type && format == FORMAT_BINARY ;
28
+ return POINT == type ;
29
29
}
30
30
31
31
@ Override
@@ -34,16 +34,12 @@ Point doDecode(ByteBuf buffer, PostgresqlObjectId dataType, Format format, Class
34
34
Assert .requireNonNull (type , "type must not be null" );
35
35
Assert .requireNonNull (format , "format must not be null" );
36
36
37
- try {
38
- String decodedAsString = ByteBufUtils .decode (buffer );
39
- String parenRemovedVal = decodedAsString .replaceAll ("[()]" , "" );
40
- String [] coordinatesAsString = parenRemovedVal .split ("," );
41
- double x = Double .parseDouble (coordinatesAsString [0 ]);
42
- double y = Double .parseDouble (coordinatesAsString [1 ]);
43
- return new Point (x , y );
44
- } catch (NumberFormatException | NullPointerException | ArrayIndexOutOfBoundsException e ) {
45
- throw new IllegalArgumentException (e );
46
- }
37
+ String decodedAsString = ByteBufUtils .decode (buffer );
38
+ String parenRemovedVal = decodedAsString .replaceAll ("[()]" , "" );
39
+ String [] coordinatesAsString = parenRemovedVal .split ("," );
40
+ double x = Double .parseDouble (coordinatesAsString [0 ]);
41
+ double y = Double .parseDouble (coordinatesAsString [1 ]);
42
+ return new Point (x , y );
47
43
}
48
44
49
45
/**
@@ -53,7 +49,7 @@ Point doDecode(ByteBuf buffer, PostgresqlObjectId dataType, Format format, Class
53
49
@ Override
54
50
Parameter doEncode (Point value ) {
55
51
Assert .requireNonNull (value , "value must not be null" );
56
- String encodedValue = "(" + value .x + "," + value .y + ")" ;
52
+ String encodedValue = "(" + value .getX () + "," + value .getY () + ")" ;
57
53
return create (POINT , FORMAT_BINARY , () -> ByteBufUtils .encode (this .byteBufAllocator , encodedValue ));
58
54
}
59
55
0 commit comments