Author: andreas
Date: Thu Sep 13 05:50:13 2007
New Revision: 575297
URL: http://svn.apache.org/viewvc?rev=575297&view=rev
Log:
Fixed lock update when copying revisions. This fixes bug 43297.
Modified:
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java?rev=575297&r1=575296&r2=575297&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java Thu Sep 13 05:50:13 2007
@@ -552,10 +552,7 @@
protected void copyRevisions(Document sourceDoc, Document targetDoc) throws PublicationException {
try {
Node targetNode = targetDoc.getRepositoryNode();
- // reset the lock so that the node doesn't complain about being changed
- targetNode.unlock();
targetNode.copyRevisionsFrom(sourceDoc.getRepositoryNode());
- targetNode.lock();
} catch (Exception e) {
throw new PublicationException(e);
}
Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java?rev=575297&r1=575296&r2=575297&view=diff
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java Thu Sep 13 05:50:13 2007
@@ -246,13 +246,12 @@
}
try {
int currentRev = getCurrentRevisionNumber();
-
int contentLoadRev = getContentSource().getLoadRevision();
int contentRev = contentLoadRev == -1 ? currentRev : contentLoadRev;
-
+
int metaLoadRev = getMetaSource().getLoadRevision();
int metaRev = metaLoadRev == -1 ? currentRev : metaLoadRev;
-
+
int lockRev = Math.min(contentRev, metaRev);
this.lock = getSession().createLock(this, lockRev);
} catch (TransactionException e) {
@@ -463,8 +462,19 @@
public void copyRevisionsFrom(Node source) throws RepositoryException {
try {
+ boolean wasLocked = isLocked();
+ if (wasLocked) {
+ unlock();
+ }
getRcml().copyFrom(this, source);
+ if (wasLocked) {
+ // this is a hack: update the lock revision to the latest copied revision to avoid
+ // the "node has changed" error
+ this.lock = getSession().createLock(this, getCurrentRevisionNumber());
+ }
} catch (RevisionControlException e) {
+ throw new RepositoryException(e);
+ } catch (TransactionException e) {
throw new RepositoryException(e);
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.