diff --git a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy index 34c71515..3a38a37e 100644 --- a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy @@ -18,6 +18,7 @@ import com.muwire.core.DownloadedFile import com.muwire.core.EventBus import com.muwire.core.connection.I2PConnector import com.muwire.core.files.FileDownloadedEvent +import com.muwire.core.util.DataUtil import groovy.util.logging.Log import net.i2p.data.Destination @@ -269,7 +270,7 @@ public class Downloader { writePieces() } } catch (Exception bad) { - log.log(Level.WARNING,"Exception while downloading",bad) + log.log(Level.WARNING,"Exception while downloading",DataUtil.findRoot(bad)) } finally { currentState = WorkerState.FINISHED if (pieces.isComplete() && eventFired.compareAndSet(false, true)) { diff --git a/core/src/main/groovy/com/muwire/core/util/DataUtil.groovy b/core/src/main/groovy/com/muwire/core/util/DataUtil.groovy index 238fa871..662ae9fd 100644 --- a/core/src/main/groovy/com/muwire/core/util/DataUtil.groovy +++ b/core/src/main/groovy/com/muwire/core/util/DataUtil.groovy @@ -109,4 +109,10 @@ class DataUtil { } available } + + public static Exception findRoot(Exception e) { + while(e.getCause() != null) + e = e.getCause() + e + } }