projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Return optionals of fields.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
SoneRescuer.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java
b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java
index
d3924aa
..
e28f49d
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/SoneRescuer.java
+++ b/
src/main/java/net/pterodactylus/sone/core/SoneRescuer.java
@@
-17,10
+17,15
@@
package net.pterodactylus.sone.core;
package net.pterodactylus.sone.core;
+import static net.pterodactylus.sone.data.Sone.TO_FREENET_URI;
+
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.service.AbstractService;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.service.AbstractService;
+
import freenet.keys.FreenetURI;
import freenet.keys.FreenetURI;
+import com.google.common.base.Optional;
+
/**
* The Sone rescuer downloads older editions of a Sone and updates the currently
* stored Sone with it.
/**
* The Sone rescuer downloads older editions of a Sone and updates the currently
* stored Sone with it.
@@
-62,7
+67,7
@@
public class SoneRescuer extends AbstractService {
this.core = core;
this.soneDownloader = soneDownloader;
this.sone = sone;
this.core = core;
this.soneDownloader = soneDownloader;
this.sone = sone;
- currentEdition =
sone.getRequestUri(
).getEdition();
+ currentEdition =
TO_FREENET_URI.apply(sone
).getEdition();
}
//
}
//
@@
-154,13
+159,13
@@
public class SoneRescuer extends AbstractService {
}
if (fetching) {
core.lockSone(sone);
}
if (fetching) {
core.lockSone(sone);
- FreenetURI soneUri =
sone.getRequestUri(
).setKeyType("SSK").setDocName("Sone-" + currentEdition).setMetaString(new String[] { "sone.xml" });
+ FreenetURI soneUri =
TO_FREENET_URI.apply(sone
).setKeyType("SSK").setDocName("Sone-" + currentEdition).setMetaString(new String[] { "sone.xml" });
System.out.println("URI: " + soneUri);
System.out.println("URI: " + soneUri);
-
Sone
fetchedSone = soneDownloader.fetchSone(sone, soneUri, true);
+
Optional<Sone>
fetchedSone = soneDownloader.fetchSone(sone, soneUri, true);
System.out.println("Sone: " + fetchedSone);
System.out.println("Sone: " + fetchedSone);
- lastFetchSuccessful =
(fetchedSone != null
);
+ lastFetchSuccessful =
fetchedSone.isPresent(
);
if (lastFetchSuccessful) {
if (lastFetchSuccessful) {
- core.updateSone(fetchedSone, true);
+ core.updateSone(fetchedSone
.get()
, true);
}
fetching = false;
}
}
fetching = false;
}