[jboss-cvs] JBossBlog SVN: r285 - in trunk: resources/WEB-INF and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 8 07:56:17 EDT 2008


Author: adamw
Date: 2008-04-08 07:56:17 -0400 (Tue, 08 Apr 2008)
New Revision: 285

Modified:
   trunk/build.properties
   trunk/resources/WEB-INF/urlrewrite.xml
   trunk/resources/WEB-INF/web-dev.xml
   trunk/src/action/org/jboss/blog/session/update/UpdateThread.java
Log:


Modified: trunk/build.properties
===================================================================
--- trunk/build.properties	2008-04-07 12:04:47 UTC (rev 284)
+++ trunk/build.properties	2008-04-08 11:56:17 UTC (rev 285)
@@ -1,6 +1,6 @@
 #jboss.home = /Users/adamwarski/portal-extensions/feeds/binaries
-#jboss.home = /Users/adamwarski/jboss/jboss-4.2
-jboss.home = /Users/adamwarski/jboss/jboss-4.0.5
-#profile = dev
-profile = prod
+jboss.home = /Users/adamwarski/jboss/jboss-4.2
+#jboss.home = /Users/adamwarski/jboss/jboss-4.0.5
+profile = dev
+#profile = prod
 #jboss.home = /Users/adamwarski/jboss/jboss-design
\ No newline at end of file

Modified: trunk/resources/WEB-INF/urlrewrite.xml
===================================================================
--- trunk/resources/WEB-INF/urlrewrite.xml	2008-04-07 12:04:47 UTC (rev 284)
+++ trunk/resources/WEB-INF/urlrewrite.xml	2008-04-08 11:56:17 UTC (rev 285)
@@ -17,8 +17,8 @@
     </rule>
 
     <outbound-rule>
-        <from>^/feeds/home.seam$</from>
-        <to>/feeds/</to>
+        <from>^(.*)/feeds/home.seam$</from>
+        <to>$1/feeds/</to>
     </outbound-rule>
 
     <!-- Posts view -->
@@ -29,18 +29,18 @@
     </rule>
 
     <outbound-rule>
-        <from>^/feeds/view/post.seam\?post=(\w+)$</from>
-        <to>/feeds/post/$1</to>
+        <from>^(.*)/feeds/view/post.seam\?post=(\w+)$</from>
+        <to>$1/feeds/post/$2</to>
     </outbound-rule>
 
     <outbound-rule>
-        <from>^/feeds/view/post.seam\?post=(\w+)&amp;(.+)$</from>
-        <to>/feeds/post/$1?$2</to>
+        <from>^(.*)/feeds/view/post.seam\?post=(\w+)&amp;(.+)$</from>
+        <to>$1/feeds/post/$2?$3</to>
     </outbound-rule>
 
     <outbound-rule>
-        <from>^/feeds/view/post.seam\?cid=(\d+)&amp;post=(\w+)(.*)$</from>
-        <to>/feeds/post/$2?cid=$1$3</to>
+        <from>^(.*)/feeds/view/post.seam\?cid=(\d+)&amp;post=(\w+)(.*)$</from>
+        <to>$1/feeds/post/$3?cid=$2$4</to>
     </outbound-rule>
 
     <!-- Feeds -->
@@ -51,8 +51,8 @@
     </rule>
 
     <outbound-rule>
-        <from>^/feeds/feeds.seam\?type=(\w+)&amp;name=([a-z0-9_]*)$</from>
-        <to>/feeds/xml/$2?type=$1</to>
+        <from>^(.*)/feeds/feeds.seam\?type=(\w+)&amp;name=([a-z0-9_]*)$</from>
+        <to>$1/feeds/xml/$3?type=$2</to>
     </outbound-rule>
 
     <!-- Feed view -->
@@ -63,8 +63,8 @@
     </rule>
 
     <outbound-rule>
-        <from>^/feeds/view/feed.seam\?(cid=\d+&amp;)?(from=\d+)&amp;name=([a-z0-9_]+)(.*)$</from>
-        <to>/feeds/view/$3?$1$2$4</to>
+        <from>^(.*)/feeds/view/feed.seam\?(cid=\d+&amp;)?(from=\d+)&amp;name=([a-z0-9_]+)(.*)$</from>
+        <to>$1/feeds/view/$4?$2$3$5</to>
     </outbound-rule>
 
     <!-- Legacy Labs URLs -->

Modified: trunk/resources/WEB-INF/web-dev.xml
===================================================================
--- trunk/resources/WEB-INF/web-dev.xml	2008-04-07 12:04:47 UTC (rev 284)
+++ trunk/resources/WEB-INF/web-dev.xml	2008-04-08 11:56:17 UTC (rev 285)
@@ -23,7 +23,7 @@
         <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
         <init-param>
             <param-name>logLevel</param-name>
-            <param-value>WARN</param-value>
+            <param-value>DEBUG</param-value>
         </init-param>
         <init-param>
             <param-name>statusEnabled</param-name>

Modified: trunk/src/action/org/jboss/blog/session/update/UpdateThread.java
===================================================================
--- trunk/src/action/org/jboss/blog/session/update/UpdateThread.java	2008-04-07 12:04:47 UTC (rev 284)
+++ trunk/src/action/org/jboss/blog/session/update/UpdateThread.java	2008-04-08 11:56:17 UTC (rev 285)
@@ -7,7 +7,6 @@
 
 import javax.transaction.UserTransaction;
 import javax.transaction.Status;
-import javax.transaction.SystemException;
 import java.text.DateFormat;
 import java.util.Date;
 
@@ -16,60 +15,62 @@
  */
 public class UpdateThread implements Runnable {
     public void run() {
-        boolean createContexts = !Contexts.isEventContextActive() && !Contexts.isApplicationContextActive();
-        if (createContexts) {
-            Lifecycle.beginCall();
-        }
+        try {
+            boolean createContexts = !Contexts.isEventContextActive() && !Contexts.isApplicationContextActive();
+            if (createContexts) {
+                Lifecycle.beginCall();
+            }
 
-        try {
-            UserTransaction tx = null;
-            boolean txStarted = false;
             try {
-                tx = (UserTransaction) Component.getInstance("org.jboss.seam.transaction.transaction");
-                if (tx.getStatus() != Status.STATUS_ACTIVE) {
-                    txStarted = true;
-                    tx.begin();
-                }
+                UserTransaction tx = null;
+                boolean txStarted = false;
+                try {
+                    tx = (UserTransaction) Component.getInstance("org.jboss.seam.transaction.transaction");
+                    if (tx.getStatus() != Status.STATUS_ACTIVE) {
+                        txStarted = true;
+                        tx.begin();
+                    }
 
-                UpdateManager updateManager = (UpdateManager) Component.getInstance("updateManager");
+                    UpdateManager updateManager = (UpdateManager) Component.getInstance("updateManager");
 
-                try {
-                    if (!updateManager.getUpdateInProgress().getAndSet(true)) {
-                        updateManager.setLastUpdateStart(System.currentTimeMillis());
+                    try {
+                        if (!updateManager.getUpdateInProgress().getAndSet(true)) {
+                            updateManager.setLastUpdateStart(System.currentTimeMillis());
 
-                        ((UpdateHandler) Component.getInstance("updateHandler")).update();
+                            ((UpdateHandler) Component.getInstance("updateHandler")).update();
 
+                            updateManager.setLastUpdateEnd(System.currentTimeMillis());
+                            updateManager.getUpdateInProgress().set(false);
+                        } else {
+                            throw new Exception("New update started before the last one finished, at " +
+                                    DateFormat.getDateTimeInstance().format(new Date()) + "!");
+                        }
+                    } catch (Exception e) {
+                        updateManager.getGlobalExceptions().add(e);
+
                         updateManager.setLastUpdateEnd(System.currentTimeMillis());
                         updateManager.getUpdateInProgress().set(false);
-                    } else {
-                        throw new Exception("New update started before the last one finished, at " +
-                                DateFormat.getDateTimeInstance().format(new Date()) + "!");
                     }
-                } catch (Exception e) {
-                    updateManager.getGlobalExceptions().add(e);
 
-                    updateManager.setLastUpdateEnd(System.currentTimeMillis());
-                    updateManager.getUpdateInProgress().set(false);
-                }
-
-                if (txStarted) {
-                    tx.commit();
-                }
-            } catch (Exception e) {
-                try {
                     if (txStarted) {
-                        tx.rollback();
+                        tx.commit();
                     }
-                } catch (SystemException e1) {
-                    Logging.getLog(UpdateManager.class).error("Exception when rolling back the transaction", e1);
+                } catch (Throwable e) {
+                    try {
+                        if (txStarted) {
+                            tx.rollback();
+                        }
+                    } catch (Throwable e1) {
+                        Logging.getLog(UpdateManager.class).error("Exception when rolling back the transaction", e1);
+                    }
                 }
-
-                e.printStackTrace();
+            } finally {
+                if (createContexts) {
+                    Lifecycle.endCall();
+                }
             }
-        } finally {
-            if (createContexts) {
-                Lifecycle.endCall();
-            }
+        } catch (Throwable t) {
+            Logging.getLog(UpdateManager.class).error("Exception when updating!", t);
         }
     }
 }




More information about the jboss-cvs-commits mailing list