Ecf Bittorent API を介してトレントをダウンロードしようとしていますが、実行中のスレッドごとに NegativeArraySizeExceptions が発生しました。
私のコード:
package com.djoxx.freakzlauncher;
import java.io.File;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import org.eclipse.bittorrent.ITorrentStateListener;
import org.eclipse.bittorrent.Torrent;
import org.eclipse.bittorrent.TorrentConfiguration;
import org.eclipse.bittorrent.TorrentConfiguration.IDebugListener;
import org.eclipse.bittorrent.TorrentFactory;
import org.eclipse.bittorrent.TorrentFile;
import org.eclipse.bittorrent.TorrentServer;
import org.eclipse.bittorrent.internal.net.TorrentManager;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
try {
ITorrentStateListener stateListener =
new ITorrentStateListener() {
public void stateChanged(int state) {
switch (state) {
case ITorrentStateListener.STARTED:
System.out.println("The torrent set-up is starting...");
break;
case ITorrentStateListener.EXCHANGING:
System.out.println("Exchanging pieces with peers...");
break;
case ITorrentStateListener.STOPPED:
System.out.println("The exchanging has stopped...");
break;
case ITorrentStateListener.FINISHED:
System.out.println("The download is now complete...");
break;
}
}
};
File confPath = new File("F:/torrent/");
if(!confPath.exists())confPath.createNewFile();
TorrentConfiguration.setConfigurationPath(confPath);
TorrentConfiguration.setDebugListener(new IDebugListener() {
@Override
public void print(String message) {
System.out.println(message);
}
});
TorrentManager.setStatePath(new File("F:/torrent/"));
TorrentFile tf =
new TorrentFile(new File("C:/Users/Josselin/Desktop/torrent.torrent"));
tf.setTargetFile(new File("F:/torrent/"));
final Torrent torrent = TorrentFactory.createTorrent(tf);
torrent.addTorrentStateListener(stateListener);
torrent.start();
/*Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
torrent.stop();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}, (long)10000);*/
}
catch (IllegalArgumentException | IllegalStateException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
この例外がどのように発生するのかはよくわかりませんが、インターネット接続が原因である可能性があると思います...
手がかりはありますか?
編集:問題があれば、JRE 7を使用しています
スタックトレース(大きい):
The torrent set-up is starting...
Exchanging pieces with peers...
Exception in thread "Thread-28" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-7" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-23" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-5" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-19" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-27" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-12" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-8" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-24" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-25" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-26" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-38" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-39" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-18" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-29" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-21" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-36" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-34" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-48" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-41" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-42" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-45" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-47" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-17" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-49" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.query(PeerConnection.java:478)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:357)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-20" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-40" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-10" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-2" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-35" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-43" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-6" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-13" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-30" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-15" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-9" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.query(PeerConnection.java:478)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:357)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-37" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:328)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)
Exception in thread "Thread-3" java.lang.NegativeArraySizeException
at org.eclipse.bittorrent.internal.net.PeerConnection.processBitfield(PeerConnection.java:756)
at org.eclipse.bittorrent.internal.net.PeerConnection.query(PeerConnection.java:478)
at org.eclipse.bittorrent.internal.net.PeerConnection.call(PeerConnection.java:357)
at org.eclipse.bittorrent.internal.net.PeerConnection.connect(PeerConnection.java:230)
at org.eclipse.bittorrent.internal.net.PeerConnection.run(PeerConnection.java:1242)