Author: jflesch
Date: 2007-08-13 15:30:23 +0000 (Mon, 13 Aug 2007)
New Revision: 14648

Modified:
   trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java
Log:
Fix index loading : When a download failed, it didn't notify the tree

Modified: trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java  2007-08-13 15:22:48 UTC 
(rev 14647)
+++ trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java  2007-08-13 15:30:23 UTC 
(rev 14648)
@@ -42,10 +42,7 @@
                        Logger.warning(new FreenetURIHelper(), 
"UnsupportedEncodingException (UTF-8): "+e.toString());
                }

-               if ((uri.indexOf("CHK@") < 0)
-                   && (uri.indexOf("USK@") < 0)
-                   && (uri.indexOf("KSK@") < 0)
-                   && (uri.indexOf("SSK@") < 0)) {
+               if (!isAKey(uri)) {
                        Logger.notice(new FreenetURIHelper(), "Not a valid key: 
"+uri);
                        return null;
                }
@@ -131,7 +128,7 @@
        }


-       public static String abs(final String val) {
+       private static String abs(final String val) {
                try {
                        final java.math.BigDecimal bd = new 
java.math.BigDecimal(val);
                        return bd.abs().toString();

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-08-13 15:22:48 UTC 
(rev 14647)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-08-13 15:30:23 UTC 
(rev 14648)
@@ -896,56 +896,61 @@
                if (o instanceof FCPClientGet) {
                        FCPClientGet get = (FCPClientGet)o;

-                       if (get.isFinished() && get.isSuccessful()) {
+                       if (get.isFinished()) {
                                get.deleteObserver(this);

-                               String key = get.getFileKey();
+                               if (get.isSuccessful()) {

-                               int oldRev = rev;
-                               int newRev = 
FreenetURIHelper.getUSKRevision(key);
+                                       String key = get.getFileKey();

-                               if (rewriteKey) {
-                                       setPublicKey(key, newRev);
-                               }
+                                       int oldRev = rev;
+                                       int newRev = 
FreenetURIHelper.getUSKRevision(key);

-                               if (oldRev < newRev || isNew) {
-                                       setHasChangedFlag(true);
-                                       useTrayIconToNotifyNewRev();
-                               }
+                                       if (rewriteKey) {
+                                               setPublicKey(key, newRev);
+                                       }

-                               isNew = false;
+                                       if (oldRev < newRev || isNew) {
+                                               setHasChangedFlag(true);
+                                               useTrayIconToNotifyNewRev();
+                                       }

-                               String path = get.getPath();
+                                       isNew = false;

-                               if (path != null) {
-                                       IndexParser parser = new 
IndexParser(this);
+                                       String path = get.getPath();

-                                       parser.loadXML(path);
+                                       if (path != null) {
+                                               IndexParser parser = new 
IndexParser(this);

+                                               parser.loadXML(path);

-                                       if (!fetchingNegRev && mustFetchNegRev) 
{
-                                               final java.io.File fl = new 
java.io.File(path);
-                                               fl.delete();

-                                               setChanged();
-                                               notifyObservers();
+                                               if (!fetchingNegRev && 
mustFetchNegRev) {
+                                                       final java.io.File fl = 
new java.io.File(path);
+                                                       fl.delete();

-                                               fetchingNegRev = true;
-                                               realDownloadFromFreenet(-1);
-                                               return;
-                                       }
+                                                       setChanged();
+                                                       notifyObservers();

-                                       boolean loadComm = true;
+                                                       fetchingNegRev = true;
+                                                       
realDownloadFromFreenet(-1);
+                                                       return;
+                                               }

-                                       if (config != null && 
config.getValue("indexFetchComments") != null)
-                                               loadComm = 
Boolean.valueOf(config.getValue("indexFetchComments")).booleanValue();
+                                               boolean loadComm = true;

-                                       if (getCommentPublicKey() != null && 
loadComm) {
-                                               loadComments(queueManager);
-                                       } else if (indexTree != null)
-                                               
indexTree.removeUpdatingIndex(this);
-                               } else
-                                       Logger.error(this, "No path specified 
in transfer ?!");
+                                               if (config != null && 
config.getValue("indexFetchComments") != null)
+                                                       loadComm = 
Boolean.valueOf(config.getValue("indexFetchComments")).booleanValue();
+
+                                               if (getCommentPublicKey() != 
null && loadComm) {
+                                                       
loadComments(queueManager);
+                                               } else if (indexTree != null)
+                                                       
indexTree.removeUpdatingIndex(this);
+                                       } else
+                                               Logger.error(this, "No path 
specified in transfer ?!");
+                               } else { /* if not successful */
+                                       indexTree.removeUpdatingIndex(this);
+                               }
                        }
                }


Modified: 
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java   
2007-08-13 15:22:48 UTC (rev 14647)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java   
2007-08-13 15:30:23 UTC (rev 14648)
@@ -157,7 +157,7 @@
                }

                if (alreadyInTheDb(db, messageId)) {
-                       Logger.info(this, "We have already this id in the db 
?!");
+                       Logger.notice(this, "We have already this id in the db 
?!");
                        archived = true;
                        read = true;
                }
@@ -359,7 +359,13 @@

                identity = Identity.getIdentity(db, nick, publicKey);

-               return identity.check(getSignedContent(true), signature);
+               boolean ret = identity.check(getSignedContent(true), signature);
+
+               if (!ret) {
+                       Logger.warning(this, "Invalid signature !");
+               }
+
+               return ret;
        }




Reply via email to