Author: j16sdiz
Date: 2008-12-14 13:20:14 +0000 (Sun, 14 Dec 2008)
New Revision: 24310

Modified:
   trunk/plugins/XMLSpider/XMLSpider.java
Log:
blar

Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java      2008-12-14 13:13:00 UTC (rev 
24309)
+++ trunk/plugins/XMLSpider/XMLSpider.java      2008-12-14 13:20:14 UTC (rev 
24310)
@@ -133,6 +133,21 @@
                }
        }
 
+       static class Term {
+               /** MD5 of the term */
+               String md5;
+               /** Term */
+               String word;
+
+               public Term(String word) {
+                       this.word = word;
+                       md5 = MD5(word);
+               }
+
+               public Term() {
+               }
+       }
+       
        /** Document ID of fetching documents */
        protected Map<Page, ClientGetter> runningFetch = new HashMap<Page, 
ClientGetter>();
 
@@ -797,14 +812,19 @@
        /*
         * calculate the md5 for a given string
         */
-       private static String MD5(String text) throws NoSuchAlgorithmException, 
UnsupportedEncodingException  {
-               MessageDigest md;
-               md = MessageDigest.getInstance("MD5");
-               byte[] md5hash = new byte[32];
-               byte[] b = text.getBytes("UTF-8");
-               md.update(b, 0, b.length);
-               md5hash = md.digest();
-               return convertToHex(md5hash);
+       private static String MD5(String text) {
+               try {
+                       MessageDigest md = MessageDigest.getInstance("MD5");
+                       byte[] md5hash = new byte[32];
+                       byte[] b = text.getBytes("UTF-8");
+                       md.update(b, 0, b.length);
+                       md5hash = md.digest();
+                       return convertToHex(md5hash);
+               } catch (UnsupportedEncodingException e) {
+                       throw new RuntimeException("UTF-8 not supported", e);
+               } catch (NoSuchAlgorithmException e) {
+                       throw new RuntimeException("MD5 not supported", e);
+               }
        }
 
        public void generateSubIndex(String filename){

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to