svnno****@sourc*****
svnno****@sourc*****
2008年 6月 5日 (木) 10:24:31 JST
Revision: 960 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=960 Author: shinsuke Date: 2008-06-05 10:24:31 +0900 (Thu, 05 Jun 2008) Log Message: ----------- fixed JS2-886 Modified Paths: -------------- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java -------------- next part -------------- Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java 2008-06-05 01:00:40 UTC (rev 959) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java 2008-06-05 01:24:31 UTC (rev 960) @@ -20,11 +20,16 @@ import java.sql.Timestamp; import java.util.Collection; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.jetspeed.prefs.om.Node; public class NodeImplProxy implements Node { + /** Logger. */ + private static final Log log = LogFactory.getLog(NodeImplProxy.class); + private Node node = null; private boolean dirty = false; @@ -162,8 +167,24 @@ } 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(); + if (log.isDebugEnabled()) + { + log.debug("re-create node: " + node.getFullPath(), e); + } } } Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java 2008-06-05 01:00:40 UTC (rev 959) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java 2008-06-05 01:24:31 UTC (rev 960) @@ -83,51 +83,57 @@ 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) + catch (NodeDoesNotExistException 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; + 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); + "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; + } + } } - } /**