BOMInputStream shouldn't sort array of BOMs in-place.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -83,6 +83,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="IO-503" dev="ggregory" type="fix">
Update platform requirement to Java 7.
</action>
+ <action issue="IO-537" dev="ggregory" type="fix" due-to="Borys Zibrov">
+ BOMInputStream shouldn't sort array of BOMs in-place.
+ </action>
<action issue="IO-506" dev="ggregory" type="update" due-to="Christian Schulte">
Deprecate methods FileSystemUtils.freeSpaceKb().
</action>

MODIFY
src/main/java/org/apache/commons/io/input/BOMInputStream.java
src/main/java/org/apache/commons/io/input/BOMInputStream.java
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -168,9 +169,10 @@ public BOMInputStream(final InputStream delegate, final boolean include, final B
throw new IllegalArgumentException("No BOMs specified");
}
this.include = include;
+ List<ByteOrderMark> list = Arrays.asList(boms);
// Sort the BOMs to match the longest BOM first because some BOMs have the same starting two bytes.
- Arrays.sort(boms, ByteOrderMarkLengthComparator);
- this.boms = Arrays.asList(boms);
+ Collections.sort(list, ByteOrderMarkLengthComparator);
+ this.boms = list;
}

[IO-537] BOMInputStream shouldn't sort array of BOMs in-place.