portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r663308 - in /portals/jetspeed-2/portal: branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/ branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/ trunk/compo...
Date Wed, 04 Jun 2008 17:08:33 GMT
Author: taylor
Date: Wed Jun  4 10:08:33 2008
New Revision: 663308

URL: http://svn.apache.org/viewvc?rev=663308&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-886
Improve 2.1.x Jetspeed Preferences Creation Algorithm

Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
Wed Jun  4 10:08:33 2008
@@ -153,6 +153,7 @@
     {
     	this.node = node;
     }
+    
     protected void reset()
     {
     	try
@@ -162,10 +163,17 @@
     	}
     	catch (Exception e)
     	{
-    		e.printStackTrace();
-    		node = null;
+            try
+            {
+                // try again, we may have ran out of connections as reproduced May 2008
+                provider.redoNode(this,node.getFullPath(), node.getNodeType());
+                dirty = false;                
+            }
+            catch (Exception e2)
+            {
+                throw new RuntimeException("Failed to reset preference node. Unable to load
node.", e2);                 
+            }
+    	    e.printStackTrace();            
     	}
-    }
-    
-
+    }    
 }

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Wed Jun  4 10:08:33 2008
@@ -79,49 +79,55 @@
     public PreferencesImpl(PreferencesImpl parent, String nodeName, int nodeType) throws
IllegalStateException
     {
         super(parent, nodeName);
-
         try
         {
-            if (parent != null)
-            {
-                this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
-            }
-            else
-            {
-                this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
-            }
-
-            newNode = true;
+            node = prefsProvider.getNode(this.absolutePath(), nodeType);
+            newNode = false;
         }
-        catch (FailedToCreateNodeException e)
-        {
-            IllegalStateException ise = new IllegalStateException("Failed to create new Preferences
of type "
-                    + nodeType + " for path " + this.absolutePath());
-            ise.initCause(e);
-            throw ise;
-        }
-        catch (NodeAlreadyExistsException e)
+        catch (NodeDoesNotExistException e1)
         {
             try
             {
-                node = prefsProvider.getNode(this.absolutePath(), nodeType);
-                newNode = false;
+                if (parent != null)
+                {
+                    this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
+                }
+                else
+                {
+                    this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
+                }
+
+                newNode = true;
             }
-            catch (NodeDoesNotExistException e1)
+            catch (FailedToCreateNodeException e)
             {
-                // If we get this at this point something is very wrong
-                IllegalStateException ise = new IllegalStateException(
-                        "Unable to create node for Preferences of type "
-                                + nodeType
-                                + " for path "
-                                + this.absolutePath()
-                                + ".  If you see this exception at this, it more than likely
means that the Preferences backing store is corrupt.");
-                ise.initCause(e1);
+                IllegalStateException ise = new IllegalStateException("Failed to create new
Preferences of type "
+                        + nodeType + " for path " + this.absolutePath());
+                ise.initCause(e);
                 throw ise;
             }
+            catch (NodeAlreadyExistsException e)
+            {
+                try
+                {
+                    node = prefsProvider.getNode(this.absolutePath(), nodeType);
+                    newNode = false;
+                }
+                catch (NodeDoesNotExistException e2)
+                {
+                    // If we get this at this point something is very wrong
+                    IllegalStateException ise = new IllegalStateException(
+                            "Unable to create node for Preferences of type "
+                                    + nodeType
+                                    + " for path "
+                                    + this.absolutePath()
+                                    + ".  If you see this exception at this, it more than
likely means that the Preferences backing store is corrupt.");
+                    ise.initCause(e2);
+                    throw ise;
+                }
+            }
         }
-
-    }
+    }        
 
     /**
      * @see java.util.prefs.Preferences#childrenNamesSpi()

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
Wed Jun  4 10:08:33 2008
@@ -153,19 +153,28 @@
     {
     	this.node = node;
     }
+
     protected void reset()
     {
-    	try
-    	{
-    		provider.redoNode(this,node.getFullPath(), node.getNodeType());
-    		dirty = false;
-    	}
-    	catch (Exception e)
-    	{
-    		e.printStackTrace();
-    		node = null;
-    	}
-    }
-    
+        try
+        {
+            provider.redoNode(this,node.getFullPath(), node.getNodeType());
+            dirty = false;
+        }
+        catch (Exception e)
+        {
+            try
+            {
+                // try again, we may have ran out of connections as reproduced May 2008
+                provider.redoNode(this,node.getFullPath(), node.getNodeType());
+                dirty = false;                
+            }
+            catch (Exception e2)
+            {
+                throw new RuntimeException("Failed to reset preference node. Unable to load
node.", e2);                 
+            }
+            e.printStackTrace();            
+        }
+    }        
 
 }

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Wed Jun  4 10:08:33 2008
@@ -79,48 +79,54 @@
     public PreferencesImpl(PreferencesImpl parent, String nodeName, int nodeType) throws
IllegalStateException
     {
         super(parent, nodeName);
-
         try
         {
-            if (parent != null)
-            {
-                this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
-            }
-            else
-            {
-                this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
-            }
-
-            newNode = true;
-        }
-        catch (FailedToCreateNodeException e)
-        {
-            IllegalStateException ise = new IllegalStateException("Failed to create new Preferences
of type "
-                    + nodeType + " for path " + this.absolutePath());
-            ise.initCause(e);
-            throw ise;
+            node = prefsProvider.getNode(this.absolutePath(), nodeType);
+            newNode = false;
         }
-        catch (NodeAlreadyExistsException e)
+        catch (NodeDoesNotExistException e1)
         {
             try
             {
-                node = prefsProvider.getNode(this.absolutePath(), nodeType);
-                newNode = false;
+                if (parent != null)
+                {
+                    this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
+                }
+                else
+                {
+                    this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
+                }
+
+                newNode = true;
             }
-            catch (NodeDoesNotExistException e1)
+            catch (FailedToCreateNodeException e)
             {
-                // If we get this at this point something is very wrong
-                IllegalStateException ise = new IllegalStateException(
-                        "Unable to create node for Preferences of type "
-                                + nodeType
-                                + " for path "
-                                + this.absolutePath()
-                                + ".  If you see this exception at this, it more than likely
means that the Preferences backing store is corrupt.");
-                ise.initCause(e1);
+                IllegalStateException ise = new IllegalStateException("Failed to create new
Preferences of type "
+                        + nodeType + " for path " + this.absolutePath());
+                ise.initCause(e);
                 throw ise;
             }
+            catch (NodeAlreadyExistsException e)
+            {
+                try
+                {
+                    node = prefsProvider.getNode(this.absolutePath(), nodeType);
+                    newNode = false;
+                }
+                catch (NodeDoesNotExistException e2)
+                {
+                    // If we get this at this point something is very wrong
+                    IllegalStateException ise = new IllegalStateException(
+                            "Unable to create node for Preferences of type "
+                                    + nodeType
+                                    + " for path "
+                                    + this.absolutePath()
+                                    + ".  If you see this exception at this, it more than
likely means that the Preferences backing store is corrupt.");
+                    ise.initCause(e2);
+                    throw ise;
+                }
+            }
         }
-
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
Wed Jun  4 10:08:33 2008
@@ -153,19 +153,28 @@
     {
     	this.node = node;
     }
+
     protected void reset()
     {
-    	try
-    	{
-    		provider.redoNode(this,node.getFullPath(), node.getNodeType());
-    		dirty = false;
-    	}
-    	catch (Exception e)
-    	{
-    		e.printStackTrace();
-    		node = null;
-    	}
-    }
-    
+        try
+        {
+            provider.redoNode(this,node.getFullPath(), node.getNodeType());
+            dirty = false;
+        }
+        catch (Exception e)
+        {
+            try
+            {
+                // try again, we may have ran out of connections as reproduced May 2008
+                provider.redoNode(this,node.getFullPath(), node.getNodeType());
+                dirty = false;                
+            }
+            catch (Exception e2)
+            {
+                throw new RuntimeException("Failed to reset preference node. Unable to load
node.", e2);                 
+            }
+            e.printStackTrace();            
+        }
+    }        
 
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=663308&r1=663307&r2=663308&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Wed Jun  4 10:08:33 2008
@@ -81,49 +81,54 @@
     PreferencesImpl(PreferencesImpl parent, PreferencesProviderWrapper ppw, String nodeName,
int nodeType) throws IllegalStateException
     {
         super(parent, nodeName);
-
         try
         {
-            this.ppw = ppw;
-            if (parent != null)
-            {
-                this.node = ppw.provider().createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
-            }
-            else
-            {
-                this.node = ppw.provider().createNode(null, nodeName, nodeType, this.absolutePath());
-            }
-
-            newNode = true;
-        }
-        catch (FailedToCreateNodeException e)
-        {
-            IllegalStateException ise = new IllegalStateException("Failed to create new Preferences
of type "
-                    + nodeType + " for path " + this.absolutePath());
-            ise.initCause(e);
-            throw ise;
+            node = prefsProvider.getNode(this.absolutePath(), nodeType);
+            newNode = false;
         }
-        catch (NodeAlreadyExistsException e)
+        catch (NodeDoesNotExistException e1)
         {
             try
             {
-                node = ppw.provider().getNode(this.absolutePath(), nodeType);
-                newNode = false;
+                if (parent != null)
+                {
+                    this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
+                }
+                else
+                {
+                    this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
+                }
+
+                newNode = true;
             }
-            catch (NodeDoesNotExistException e1)
+            catch (FailedToCreateNodeException e)
             {
-                // If we get this at this point something is very wrong
-                IllegalStateException ise = new IllegalStateException(
-                        "Unable to create node for Preferences of type "
-                                + nodeType
-                                + " for path "
-                                + this.absolutePath()
-                                + ".  If you see this exception at this, it more than likely
means that the Preferences backing store is corrupt.");
-                ise.initCause(e1);
+                IllegalStateException ise = new IllegalStateException("Failed to create new
Preferences of type "
+                        + nodeType + " for path " + this.absolutePath());
+                ise.initCause(e);
                 throw ise;
             }
+            catch (NodeAlreadyExistsException e)
+            {
+                try
+                {
+                    node = prefsProvider.getNode(this.absolutePath(), nodeType);
+                    newNode = false;
+                }
+                catch (NodeDoesNotExistException e2)
+                {
+                    // If we get this at this point something is very wrong
+                    IllegalStateException ise = new IllegalStateException(
+                            "Unable to create node for Preferences of type "
+                                    + nodeType
+                                    + " for path "
+                                    + this.absolutePath()
+                                    + ".  If you see this exception at this, it more than
likely means that the Preferences backing store is corrupt.");
+                    ise.initCause(e2);
+                    throw ise;
+                }
+            }
         }
-
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message