make sure coders are only used once in folder
*/
package org.apache.commons.compress.archivers.sevenz;
+import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
* only support single input stream decoders), the second reads
* from the output of the first and so on.</p>
*/
- Iterable<Coder> getOrderedCoders() {
+ Iterable<Coder> getOrderedCoders() throws IOException {
if (packedStreams == null || coders == null || packedStreams.length == 0 || coders.length == 0) {
return Collections.emptyList();
}
final LinkedList<Coder> l = new LinkedList<>();
int current = (int) packedStreams[0]; // more that 2^31 coders?
while (current >= 0 && current < coders.length) {
+ if (l.contains(coders[current])) {
+ throw new IOException("folder uses the same coder more than once in coder chain");
+ }
l.addLast(coders[current]);
final int pair = findBindPairForOutStream(current);
current = pair != -1 ? (int) bindPairs[pair].inIndex : -1;
