return a clone of browser result to fix pre processor behavior

This commit is contained in:
Sebastian Sdorra
2012-06-24 19:37:03 +02:00
parent 05bc3946a3
commit 554dcd4ffb
5 changed files with 104 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ import javax.xml.bind.annotation.XmlRootElement;
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "browser-result") @XmlRootElement(name = "browser-result")
public class BrowserResult implements Iterable<FileObject> public class BrowserResult implements Iterable<FileObject>, Cloneable
{ {
/** /**
@@ -84,6 +84,31 @@ public class BrowserResult implements Iterable<FileObject>
//~--- methods -------------------------------------------------------------- //~--- methods --------------------------------------------------------------
/**
* Create a clone of this {@link BrowserResult} object.
*
*
* @return clone of this {@link BrowserResult}
*
* @since 1.17
*/
@Override
public BrowserResult clone()
{
BrowserResult browserResult = null;
try
{
browserResult = (BrowserResult) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
return browserResult;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@@ -56,6 +56,31 @@ import javax.xml.bind.annotation.XmlRootElement;
public class FileObject implements LastModifiedAware public class FileObject implements LastModifiedAware
{ {
/**
* Create a clone of this {@link FileObject} object.
*
*
* @return clone of this {@link FileObject}
*
* @since 1.17
*/
@Override
public FileObject clone()
{
FileObject fileObject = null;
try
{
fileObject = (FileObject) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
return fileObject;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

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

View File

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

View File

@@ -184,6 +184,7 @@ public final class BrowseCommandBuilder
if (!disablePreProcessors && (result != null)) if (!disablePreProcessors && (result != null))
{ {
result = result.clone();
preProcessorUtil.prepareForReturn(repository, result); preProcessorUtil.prepareForReturn(repository, result);
List<FileObject> fileObjects = result.getFiles(); List<FileObject> fileObjects = result.getFiles();