Fire appropriate event if cancelled by user.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 04:35:17 +0000 (06:35 +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

index 3466ead..90383e1 100644 (file)
@@ -432,7 +432,11 @@ public class FreenetInterface {
                @Override
                public void onFailure(InsertException insertException, BaseClientPutter clientPutter, ObjectContainer objectContainer) {
                        for (ImageInsertListener imageInsertListener : imageInsertListeners) {
-                               imageInsertListener.imageInsertFailed(image, insertException);
+                               if ((insertException != null) && ("Cancelled by user".equals(insertException.getMessage()))) {
+                                       imageInsertListener.imageInsertAborted(image);
+                               } else {
+                                       imageInsertListener.imageInsertFailed(image, insertException);
+                               }
                        }
                }