Cancel with a ClientContext.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 04:34:48 +0000 (06:34 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 04:41:30 +0000 (06:41 +0200)
src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
src/main/java/net/pterodactylus/sone/core/ImageInserter.java

index f7fa975..0976dca 100644 (file)
@@ -330,7 +330,7 @@ public class FreenetInterface {
         *
         * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
         */
-       public static class InsertToken implements ClientPutCallback {
+       public class InsertToken implements ClientPutCallback {
 
                /** The image being inserted. */
                private final Image image;
@@ -406,8 +406,9 @@ public class FreenetInterface {
                 *
                 * @see ImageInsertListener#imageInsertAborted(Image)
                 */
+               @SuppressWarnings("synthetic-access")
                public void cancel() {
-                       clientPutter.cancel(null, null);
+                       clientPutter.cancel(null, node.clientCore.clientContext);
                        for (ImageInsertListener imageInsertListener : imageInsertListeners) {
                                imageInsertListener.imageInsertAborted(image);
                        }
index 1881902..930fc48 100644 (file)
@@ -76,7 +76,7 @@ public class ImageInserter {
        public void insertImage(TemporaryImage temporaryImage, Image image) {
                Validation.begin().isNotNull("Temporary Image", temporaryImage).isNotNull("Image", image).check().isEqual("Image IDs", image.getId(), temporaryImage.getId()).check();
                try {
-                       InsertToken insertToken = new InsertToken(image);
+                       InsertToken insertToken = freenetInterface.new InsertToken(image);
                        insertTokens.put(image.getId(), insertToken);
                        insertToken.addImageInsertListener(core);
                        freenetInterface.insertImage(temporaryImage, image, insertToken);