fix plugin compilation after recent UnsharedFileEvent changes

pull/62/head
Zlatin Balevsky 2021-07-05 20:44:48 +01:00
parent 57e60c631b
commit 0f3c22ddd4
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 8 additions and 6 deletions

View File

@ -33,9 +33,9 @@ public class DownloadedContentServlet extends BasicServlet {
public File getResource(String pathInContext) {
String infoHashB64 = pathInContext.substring("/DownloadedContent/".length());
InfoHash infoHash = new InfoHash(Base64.decode(infoHashB64));
Set<SharedFile> sharedFiles = core.getFileManager().getRootToFiles().get(infoHash);
if (sharedFiles == null || sharedFiles.isEmpty())
SharedFile[] sharedFiles = core.getFileManager().getRootToFiles().get(infoHash);
if (sharedFiles == null || sharedFiles.length == 0)
return null;
return sharedFiles.iterator().next().getFile();
return sharedFiles[0].getFile();
}
}

View File

@ -70,7 +70,9 @@ public class FileManager {
public void onFileUnsharedEvent(FileUnsharedEvent e) {
if (!e.getDeleted())
return;
fileTree.remove(e.getUnsharedFile().getFile());
for (SharedFile sf : e.getUnsharedFiles()) {
fileTree.remove(sf.getFile());
}
revision++;
}
@ -127,7 +129,7 @@ public class FileManager {
fileTree.remove(file);
revision++;
FileUnsharedEvent event = new FileUnsharedEvent();
event.setUnsharedFile(sf);
event.setUnsharedFiles(new SharedFile[]{sf});
core.getEventBus().publish(event);
} else {
@ -139,7 +141,7 @@ public class FileManager {
for (SharedFile found : cb.found) {
FileUnsharedEvent e = new FileUnsharedEvent();
e.setUnsharedFile(found);
e.setUnsharedFiles(new SharedFile[]{found});
core.getEventBus().publish(e);
}