Commits

Sebastian Sdorra committed 343cab6

return a clone of blame result to fix pre processor behavior

  • Participants
  • Parent commits 62d3f96

Comments (0)

Files changed (3)

scm-core/src/main/java/sonia/scm/repository/BlameLine.java

  * @author Sebastian Sdorra
  * @since 1.8
  */
-public class BlameLine
+public class BlameLine implements Cloneable
 {
 
   /**
   //~--- methods --------------------------------------------------------------
 
   /**
+   * Create a clone of this {@link BlameLine} object.
+   *
+   *
+   * @return clone of this {@link BlameLine}
+   *
+   * @since 1.17
+   */
+  @Override
+  public BlameLine clone()
+  {
+    BlameLine blameLine = null;
+
+    try
+    {
+      blameLine = (BlameLine) super.clone();
+    }
+    catch (CloneNotSupportedException ex)
+    {
+      throw new RuntimeException(ex);
+    }
+
+    return blameLine;
+  }
+
+  /**
    * {@inheritDoc}
    *
    *

scm-core/src/main/java/sonia/scm/repository/BlameResult.java

 
 /**
  * Changeset information by line for a given file.
- * 
+ *
  * TODO for 2.0 implement {@link Iterable}
  *
  * @author Sebastian Sdorra
  */
 @XmlRootElement(name = "blame-result")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class BlameResult
+public class BlameResult implements Cloneable
 {
 
   /**
   //~--- methods --------------------------------------------------------------
 
   /**
+   * Create a clone of this {@link blameResult} object.
+   *
+   *
+   * @return clone of this {@link blameResult}
+   *
+   * @since 1.17
+   */
+  @Override
+  public BlameResult clone()
+  {
+    BlameResult blameResult = null;
+
+    try
+    {
+      blameResult = (BlameResult) super.clone();
+    }
+    catch (CloneNotSupportedException ex)
+    {
+      throw new RuntimeException(ex);
+    }
+
+    return blameResult;
+  }
+
+  /**
    * {@inheritDoc}
    *
    *

scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java

 
     if (!disablePreProcessors && (result != null))
     {
+      // clone result to fix pre processor behavior
+      result = result.clone();
       preProcessorUtil.prepareForReturn(repository, result);
     }