Skip to content

Commit 90bdfbc

Browse files
committed
fixed bug in BEValue.getList()
TorrentCreator uses LinkedList for some fields BEValue.getList() only supported ArrayList and threw an exception when a different type of list was used
1 parent bbe2ea1 commit 90bdfbc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • bencoding/src/main/java/com/turn/ttorrent/bcodec

bencoding/src/main/java/com/turn/ttorrent/bcodec/BEValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public long getLong() throws InvalidBEncodingException {
160160
*/
161161
@SuppressWarnings("unchecked")
162162
public List<BEValue> getList() throws InvalidBEncodingException {
163-
if (this.value instanceof ArrayList) {
164-
return (ArrayList<BEValue>) this.value;
163+
if (this.value != null && List.class.isAssignableFrom(this.value.getClass())) {
164+
return (List<BEValue>) this.value;
165165
} else {
166166
throw new InvalidBEncodingException("Excepted List<BEvalue> !");
167167
}

0 commit comments

Comments
 (0)