Author: j16sdiz
Date: 2008-12-29 01:19:39 +0000 (Mon, 29 Dec 2008)
New Revision: 24814

Modified:
   trunk/plugins/XMLSpider/XMLSpider.java
Log:
exception handling

Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java      2008-12-29 01:19:19 UTC (rev 
24813)
+++ trunk/plugins/XMLSpider/XMLSpider.java      2008-12-29 01:19:39 UTC (rev 
24814)
@@ -438,34 +438,42 @@
 
                                try {
                                        ContentFilter.filter(data, new 
NullBucketFactory(), mimeType, uri.toURI("http://127.0.0.1:8888/";),
-                                               pageCallBack);
+                                                       pageCallBack);
                                        pageCallBack.store();
+
+                                       synchronized (this) {
+                                               page.status = Status.SUCCEEDED;
+                                       page.lastChange = 
System.currentTimeMillis();
+                                       db.store(page);
+                                       db.commit();
+                               }
                                        Logger.minor(this, "Filtered " + uri + 
" : " + page.id);
                                } catch (UnsafeContentTypeException e) {
+                                       synchronized (this) {
+                                               page.status = Status.SUCCEEDED;
+                                               page.lastChange = 
System.currentTimeMillis();
+                                       db.store(page);
+                                       db.commit();
+                               }
                                        return; // Ignore
                                } catch (IOException e) {
+                                       db.rollback();
                                        Logger.error(this, "Bucket error?: " + 
e, e);
                                } catch (URISyntaxException e) {
+                                       db.rollback();
                                        Logger.error(this, "Internal error: " + 
e, e);
                                } finally {
                                        data.free();
                                }
-                               
-                       synchronized (this) {
-                               page.status = Status.SUCCEEDED;
-                               page.lastChange = System.currentTimeMillis();
-                               db.store(page);
-                               db.commit();
-                       }
+               } catch (RuntimeException e) {
+                       db.rollback();
+                       throw e;
                } finally {
                        synchronized (this) {
                                runningFetch.remove(page);
                        }
-                       if (!stopped) {
+                       if (!stopped)
                                startSomeRequests();
-                       } else {
-                               db.rollback();
-                       }
                }
        }
 

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

Reply via email to