Author: jalkanen
Date: Wed Dec 2 22:54:41 2009
New Revision: 886333
URL: http://svn.apache.org/viewvc?rev=886333&view=rev
Log:
* Fixed ContentManager.checkin() to use a separate Session for
copying - it had an off-by-one error when storing the old version.
This fixes quite a few tests...
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Modified: incubator/jspwiki/trunk/ChangeLog
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=886333&r1=886332&r2=886333&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Wed Dec 2 22:54:41 2009
@@ -1,3 +1,11 @@
+2009-12-03 Janne Jalkanen <[email protected]>
+
+ * 3.0.0-svn-188
+
+ * Fixed ContentManager.checkin() to use a separate Session for
+ copying - it had an off-by-one error when storing the old version.
+ This fixes quite a few tests...
+
2009-12-01 Janne Jalkanen <[email protected]>
* 3.0.0-svn-187
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=886333&r1=886332&r2=886333&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Wed Dec 2
22:54:41 2009
@@ -77,7 +77,7 @@
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "187";
+ public static final String BUILD = "188";
/**
* This is the generic version string you should use
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=886333&r1=886332&r2=886333&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
(original)
+++
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Wed Dec 2 22:54:41 2009
@@ -70,6 +70,8 @@
import org.priha.RepositoryManager;
import org.priha.util.ConfigurationException;
+import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
+
/**
* Provides access to the content repository. Unlike previously, in JSPWiki
@@ -409,43 +411,51 @@
*/
private void checkin( String path, int currentVersion ) throws
RepositoryException
{
- Session copierSession = getCurrentSession();
+ Session copierSession = m_sessionManager.newSession();
- // If the item does not exist yet, there is nothing to copy.
- if( !copierSession.itemExists( path ) ) return;
+ try
+ {
+ // If the item does not exist yet, there is nothing to copy.
+ if( !copierSession.itemExists( path ) ) return;
- Node nd = (Node)copierSession.getItem( path );
- Node versions;
+ Node nd = (Node)copierSession.getItem( path );
+ Node versions;
- //
- // Ensure that the versions subnode exists.
- //
- if( !nd.hasNode( WIKI_VERSIONS ) )
- {
- versions = nd.addNode( WIKI_VERSIONS );
- }
- else
- {
- versions = nd.getNode( WIKI_VERSIONS );
- }
+ //
+ // Ensure that the versions subnode exists.
+ //
+ if( !nd.hasNode( WIKI_VERSIONS ) )
+ {
+ versions = nd.addNode( WIKI_VERSIONS );
+ }
+ else
+ {
+ versions = nd.getNode( WIKI_VERSIONS );
+ }
- //
- // Figure out the path to store the contents of the current version,
- // create the Node, and copy the properties from the current version
- // to it.
- //
- String versionName = Integer.toString( currentVersion );
+ //
+ // Figure out the path to store the contents of the current
version,
+ // create the Node, and copy the properties from the current
version
+ // to it.
+ //
+ String versionName = Integer.toString( currentVersion );
- if( versions.hasNode( versionName ) )
- {
- throw new ItemExistsException("Version already exists:
"+currentVersion+". This is a JSPWiki internal error, please report!");
- }
+ if( versions.hasNode( versionName ) )
+ {
+ throw new ItemExistsException("Version already exists:
"+currentVersion+". This is a JSPWiki internal error, please report!");
+ }
- Node newVersion = versions.addNode( versionName );
+ Node newVersion = versions.addNode( versionName );
- newVersion.addMixin( "mix:referenceable" );
+ newVersion.addMixin( "mix:referenceable" );
- copyProperties( nd, newVersion );
+ copyProperties( nd, newVersion );
+ copierSession.save();
+ }
+ finally
+ {
+ copierSession.logout();
+ }
}
private void copyProperties( Node source, Node dest )