-
Notifications
You must be signed in to change notification settings - Fork 74
Description
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 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
upperset 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 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.