<dependency>
<groupId>org.freenetproject</groupId>
<artifactId>fred</artifactId>
- <version>0.7.5.1467.99.1</version>
+ <version>0.7.5.1467.99.3</version>
<scope>provided</scope>
</dependency>
<dependency>
FreenetURI targetUri = key.getInsertURI().setDocName(filenameHint);
InsertContext insertContext = client.getInsertContext(true);
RandomAccessBucket bucket = new ArrayBucket(temporaryImage.getImageData());
+ insertToken.setBucket(bucket);
ClientMetadata metadata = new ClientMetadata(temporaryImage.getMimeType());
InsertBlock insertBlock = new InsertBlock(bucket, metadata, targetUri);
try {
insertToken.setClientPutter(clientPutter);
} catch (InsertException ie1) {
throw new SoneInsertException("Could not start image insert.", ie1);
- } finally {
- bucket.free();
}
}
/** The client putter. */
private ClientPutter clientPutter;
+ private Bucket bucket;
/** The final URI. */
private volatile FreenetURI resultingUri;
eventBus.post(new ImageInsertStartedEvent(image));
}
+ public void setBucket(Bucket bucket) {
+ this.bucket = bucket;
+ }
+
//
// ACTIONS
//
} else {
eventBus.post(new ImageInsertFailedEvent(image, insertException));
}
+ bucket.free();
}
/**
@SuppressWarnings("synthetic-access")
public void onSuccess(BaseClientPutter clientPutter) {
eventBus.post(new ImageInsertFinishedEvent(image, resultingUri));
+ bucket.free();
}
}