- FetchResult fetchResult = freenetInterface.fetchUri(sone.getRequestUri().setMetaString(new String[] { "sone.xml" }));
- logger.log(Level.FINEST, "Got %d bytes back.", fetchResult.size());
- parseSone(sone, fetchResult);
+ FreenetURI requestUri = sone.getRequestUri().setMetaString(new String[] { "sone.xml" });
+ core.setSoneStatus(sone, SoneStatus.downloading);
+ try {
+ FetchResult fetchResult = freenetInterface.fetchUri(requestUri);
+ if (fetchResult == null) {
+ /* TODO - mark Sone as bad. */
+ return;
+ }
+ logger.log(Level.FINEST, "Got %d bytes back.", fetchResult.size());
+ Sone parsedSone = parseSone(sone, fetchResult, requestUri);
+ if (parsedSone != null) {
+ core.addSone(parsedSone);
+ }
+ } finally {
+ core.setSoneStatus(sone, SoneStatus.idle);
+ }