You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks Sean for providing and maintaining this library. It has really been a lifesaver!
I think I found a bug in IPAddressSeqRange.join.
Imagine attempting to join two ranges, 10.120.20.10 - 10.120.20.14 and 10.120.20.14 - 10.120.20.20. If the second range's lower is less than or equal to the first range's upper, then it
sets the second range to null, and
returns the first range, except with the first range's upper set to the second range's upper.
This results in 10.120.20.10 - 10.120.20.20, which is correct.
However, using the same logic for 10.120.20.10 - 10.120.20.20 and 10.120.20.15 - 10.120.20.15 will result in 10.120.20.10 - 10.120.20.15, which is incorrect.
Instead of always taking the second range's upper, I feel like the correct thing to do is take whichever upper is greater between the first range and the second. Thoughts?
edit: I'm using version 5.1.0 for Java 11, but I believe it is still present on 5.2.1.
edit2: Also, sidenote but I believe this method mutates the array which is passed in. Reading the javadoc, I'm not sure if this was intentional so I thought I'd mention it.
The text was updated successfully, but these errors were encountered:
Yes, you are correct, on both counts, the method is not selecting the max upper, which is a bug, and also when passing in array instead of varargs the array is mutated, which is not intended behaviour.
Hello,
First, thanks Sean for providing and maintaining this library. It has really been a lifesaver!
I think I found a bug in
IPAddressSeqRange.join
.Imagine attempting to join two ranges,
10.120.20.10 - 10.120.20.14
and10.120.20.14 - 10.120.20.20
. If the second range'slower
is less than or equal to the first range'supper
, then itupper
set to the second range'supper
.This results in
10.120.20.10 - 10.120.20.20
, which is correct.However, using the same logic for
10.120.20.10 - 10.120.20.20
and10.120.20.15 - 10.120.20.15
will result in10.120.20.10 - 10.120.20.15
, which is incorrect.Instead of always taking the second range's
upper
, I feel like the correct thing to do is take whicheverupper
is greater between the first range and the second. Thoughts?edit: I'm using version 5.1.0 for Java 11, but I believe it is still present on 5.2.1.
edit2: Also, sidenote but I believe this method mutates the array which is passed in. Reading the javadoc, I'm not sure if this was intentional so I thought I'd mention it.
The text was updated successfully, but these errors were encountered: