Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
fix: Revert inet to return as a string and handle values with net masks #1568
Reverts inet type columns to default to returning their value as the text representation returned by the backend rather than parsing them as InetAddress values. This ensures that the mask value is not lost.
Also corrects the getObject(..., InetAddress.class) handling to split out the net mask and return only the address portion.
I've also updated the tests for inet data types to clean it up a bit, explicitly test getString() / getObject(), and add some additional edge cases (ex: "10.20.30.40/32" gets round tripped by the server to strip out the /32).
When (if?) we change the default return type to give a PGInet that test should fail and need to be updated. As I tend to lean toward backwards compatibility, I think we should leave the default as a text and if anything provide PGInet as a separate class that anyone who wants can use. Could consider using something similar to handle mac data types too.
See also #1134 for related discussion.
New Feature Submissions:
Changes to Existing Features:
Yes. It reverts
Not sure what's up with the AppVeyor build. One out of four build configs failed but it's something unrelated to this PR: https://ci.appveyor.com/project/davecramer/pgjdbc/builds/27342998/job/b5394yla9yfc7aku#L479
@maffe Nice catch! Looks like that piece of the code is still in there:
I bet it's not being called as that's the fallback when the more specific getXyz(...) methods cannot figure out what to return. I'm going to try removing it and the string handling to restore the original behavior.
… net masks Reverts inet type columns to return their value as a PGObject rather than parsing them as InetAddress values. This ensures that the mask value is not lost. Also corrects the getObject(..., InetAddress.class) handling to split out the net mask and return only the address portion.
@@ Coverage Diff @@ ## master #1568 +/- ## ========================================== - Coverage 68.9% 65.2% -3.7% + Complexity 3972 3889 -83 ========================================== Files 179 179 Lines 16565 16943 +378 Branches 2695 2768 +73 ========================================== - Hits 11414 11048 -366 - Misses 3899 4610 +711 - Partials 1252 1285 +33