return a clone of changeset paging result to fix pre processor behavior

This commit is contained in:
Sebastian Sdorra
2012-06-24 19:27:44 +02:00
parent 19f437d65b
commit 05bc3946a3
5 changed files with 69 additions and 12 deletions

View File

@@ -94,10 +94,10 @@ public class BlameResult implements Cloneable
//~--- methods --------------------------------------------------------------
/**
* Create a clone of this {@link blameResult} object.
* Create a clone of this {@link BlameResult} object.
*
*
* @return clone of this {@link blameResult}
* @return clone of this {@link BlameResult}
*
* @since 1.17
*/

View File

@@ -109,21 +109,26 @@ public class Changeset extends BasicPropertiesAware
//~--- methods --------------------------------------------------------------
/**
* {@inheritDoc}
* Create a clone of this {@link Changeset} object.
*
*
* @return
* @return clone of this {@link Changeset}
*
* @since 1.17
*/
@Override
public Changeset clone()
{
Changeset changeset = new Changeset(id, date, author, description);
Changeset changeset = null;
changeset.setBranches(branches);
changeset.setTags(tags);
changeset.setModifications(modifications);
changeset.setProperties(properties);
changeset.setParents(parents);
try
{
changeset = (Changeset) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
return changeset;
}

View File

@@ -50,7 +50,7 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlRootElement(name = "changeset-paging")
@XmlAccessorType(XmlAccessType.FIELD)
public class ChangesetPagingResult implements Iterable<Changeset>
public class ChangesetPagingResult implements Iterable<Changeset>, Cloneable
{
/**
@@ -74,6 +74,31 @@ public class ChangesetPagingResult implements Iterable<Changeset>
//~--- methods --------------------------------------------------------------
/**
* Create a clone of this {@link ChangesetPagingResult} object.
*
*
* @return clone of this {@link ChangesetPagingResult}
*
* @since 1.17
*/
@Override
public ChangesetPagingResult clone()
{
ChangesetPagingResult changesetPagingResult = null;
try
{
changesetPagingResult = (ChangesetPagingResult) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
return changesetPagingResult;
}
/**
* Method description
*

View File

@@ -58,7 +58,7 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "modifications")
public class Modifications implements Serializable
public class Modifications implements Cloneable, Serializable
{
/** Field description */
@@ -113,6 +113,31 @@ public class Modifications implements Serializable
//~--- methods --------------------------------------------------------------
/**
* Create a clone of this {@link Modifications} object.
*
*
* @return clone of this {@link Modifications}
*
* @since 1.17
*/
@Override
public Modifications clone()
{
Modifications modifications = null;
try
{
modifications = (Modifications) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
return modifications;
}
/**
* {@inheritDoc}
*

View File

@@ -214,6 +214,7 @@ public final class LogCommandBuilder
if (!disablePreProcessors && (changeset != null))
{
changeset = changeset.clone();
preProcessorUtil.prepareForReturn(repository, changeset);
}
@@ -271,6 +272,7 @@ public final class LogCommandBuilder
if (!disablePreProcessors && (cpr != null))
{
cpr = cpr.clone();
preProcessorUtil.prepareForReturn(repository, cpr);
}