diff --git a/core/src/main/java/com/muwire/core/DownloadedFile.java b/core/src/main/java/com/muwire/core/DownloadedFile.java index a28089b7..f0f29df9 100644 --- a/core/src/main/java/com/muwire/core/DownloadedFile.java +++ b/core/src/main/java/com/muwire/core/DownloadedFile.java @@ -1,6 +1,7 @@ package com.muwire.core; import java.io.File; +import java.io.IOException; import java.util.Set; import net.i2p.data.Destination; @@ -9,7 +10,8 @@ public class DownloadedFile extends SharedFile { private final Set sources; - public DownloadedFile(File file, InfoHash infoHash, int pieceSize, Set sources) { + public DownloadedFile(File file, InfoHash infoHash, int pieceSize, Set sources) + throws IOException { super(file, infoHash, pieceSize); this.sources = sources; } diff --git a/core/src/main/java/com/muwire/core/SharedFile.java b/core/src/main/java/com/muwire/core/SharedFile.java index 21518311..d5b77263 100644 --- a/core/src/main/java/com/muwire/core/SharedFile.java +++ b/core/src/main/java/com/muwire/core/SharedFile.java @@ -1,6 +1,7 @@ package com.muwire.core; import java.io.File; +import java.io.IOException; public class SharedFile { @@ -8,10 +9,15 @@ public class SharedFile { private final InfoHash infoHash; private final int pieceSize; - public SharedFile(File file, InfoHash infoHash, int pieceSize) { + private final String cachedPath; + private final long cachedLength; + + public SharedFile(File file, InfoHash infoHash, int pieceSize) throws IOException { this.file = file; this.infoHash = infoHash; this.pieceSize = pieceSize; + this.cachedPath = file.getAbsolutePath(); + this.cachedLength = file.length(); } public File getFile() { @@ -35,6 +41,14 @@ public class SharedFile { return rv; } + public String getCachedPath() { + return cachedPath; + } + + public long getCachedLength() { + return cachedLength; + } + @Override public int hashCode() { return file.hashCode() ^ infoHash.hashCode(); diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index 9f8afa60..2131334a 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -167,8 +167,8 @@ class MainFrameView { scrollPane(constraints : BorderLayout.CENTER) { table(id : "shared-files-table", autoCreateRowSorter: true) { tableModel(list : model.shared) { - closureColumn(header : "Name", preferredWidth : 500, type : String, read : {row -> row.file.getAbsolutePath()}) - closureColumn(header : "Size", preferredWidth : 100, type : Long, read : {row -> row.file.length() }) + closureColumn(header : "Name", preferredWidth : 500, type : String, read : {row -> row.getCachedPath()}) + closureColumn(header : "Size", preferredWidth : 100, type : Long, read : {row -> row.getCachedLength() }) } } }