mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
merge with branch 2.0.0-m3
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
package sonia.scm;
|
||||
|
||||
public class AlreadyExistsException extends Exception {
|
||||
|
||||
public AlreadyExistsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AlreadyExistsException() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,9 @@ public class NotFoundException extends Exception {
|
||||
|
||||
public NotFoundException() {
|
||||
}
|
||||
|
||||
|
||||
public NotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,9 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import sonia.scm.BasicPropertiesAware;
|
||||
import sonia.scm.Validateable;
|
||||
import sonia.scm.ModelObject;
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.util.ValidationUtil;
|
||||
|
||||
@@ -45,12 +43,10 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a changeset/commit of a repository.
|
||||
@@ -59,43 +55,58 @@ import java.util.List;
|
||||
*/
|
||||
@XmlRootElement(name = "changeset")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class Changeset extends BasicPropertiesAware
|
||||
implements Validateable, Serializable
|
||||
{
|
||||
public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -8373308448928993039L;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
/**
|
||||
* The author of the changeset
|
||||
*/
|
||||
private Person author;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
* The name of the branches on which the changeset was committed.
|
||||
*/
|
||||
private List<String> branches;
|
||||
|
||||
/**
|
||||
* The date when the changeset was committed
|
||||
*/
|
||||
private Long date;
|
||||
|
||||
/**
|
||||
* The text of the changeset description
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* The changeset identification string
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* List of files changed by this changeset
|
||||
*/
|
||||
@XmlElement(name = "modifications")
|
||||
private Modifications modifications;
|
||||
|
||||
/**
|
||||
* parent changeset ids
|
||||
*/
|
||||
private List<String> parents;
|
||||
|
||||
/**
|
||||
* The tags associated with the changeset
|
||||
*/
|
||||
private List<String> tags;
|
||||
|
||||
public Changeset() {}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
*
|
||||
* @param id id of the changeset
|
||||
* @param date date of the changeset
|
||||
* @param author author of the changeset
|
||||
*/
|
||||
public Changeset(String id, Long date, Person author)
|
||||
{
|
||||
this(id, date, author, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
*
|
||||
* @param id id of the changeset
|
||||
* @param date date of the changeset
|
||||
* @param author author of the changeset
|
||||
* @param description description of the changeset
|
||||
*/
|
||||
public Changeset(String id, Long date, Person author, String description)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -104,16 +115,6 @@ public class Changeset extends BasicPropertiesAware
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
@@ -122,15 +123,14 @@ public class Changeset extends BasicPropertiesAware
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Changeset other = (Changeset) obj;
|
||||
|
||||
//J-
|
||||
return Objects.equal(id, other.id)
|
||||
return Objects.equal(id, other.id)
|
||||
&& Objects.equal(date, other.date)
|
||||
&& Objects.equal(author, other.author)
|
||||
&& Objects.equal(description, other.description)
|
||||
@@ -192,7 +192,21 @@ public class Changeset extends BasicPropertiesAware
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns a timestamp of the creation date of the {@link Changeset}.
|
||||
*
|
||||
* @return a timestamp of the creation date of the {@link Changeset}
|
||||
*/
|
||||
public Long getCreationDate() {
|
||||
return getDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreationDate(Long timestamp) {
|
||||
this.setDate(timestamp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the author of the changeset.
|
||||
@@ -200,14 +214,13 @@ public class Changeset extends BasicPropertiesAware
|
||||
*
|
||||
* @return author of the changeset
|
||||
*/
|
||||
public Person getAuthor()
|
||||
{
|
||||
public Person getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the branches of the changeset. In the most cases a changeset is
|
||||
* only related to one branch, but in the case of receive hooks it is possible
|
||||
* Returns the branches of the changeset. In the most cases a changeset is
|
||||
* only related to one branch, but in the case of receive hooks it is possible
|
||||
* that a changeset is related to more than a branch.
|
||||
*
|
||||
*
|
||||
@@ -251,11 +264,27 @@ public class Changeset extends BasicPropertiesAware
|
||||
*
|
||||
* @return id of the changeset
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastModified(Long timestamp) {
|
||||
throw new UnsupportedOperationException("changesets are immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getLastModified() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Changeset";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the file modifications, which was done with this changeset.
|
||||
*
|
||||
@@ -318,8 +347,6 @@ public class Changeset extends BasicPropertiesAware
|
||||
&& (date != null);
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets the author of the changeset.
|
||||
*
|
||||
@@ -409,30 +436,4 @@ public class Changeset extends BasicPropertiesAware
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** The author of the changeset */
|
||||
private Person author;
|
||||
|
||||
/** The name of the branches on which the changeset was committed. */
|
||||
private List<String> branches;
|
||||
|
||||
/** The date when the changeset was committed */
|
||||
private Long date;
|
||||
|
||||
/** The text of the changeset description */
|
||||
private String description;
|
||||
|
||||
/** The changeset identification string */
|
||||
private String id;
|
||||
|
||||
/** List of files changed by this changeset */
|
||||
@XmlElement(name = "modifications")
|
||||
private Modifications modifications;
|
||||
|
||||
/** parent changeset ids */
|
||||
private List<String> parents;
|
||||
|
||||
/** The tags associated with the changeset */
|
||||
private List<String> tags;
|
||||
}
|
||||
|
||||
@@ -249,9 +249,11 @@ public class Person implements Validateable, Serializable
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** name of the person */
|
||||
/** mail address of the person */
|
||||
private String mail;
|
||||
|
||||
/** mail address of the person */
|
||||
/**
|
||||
* name of the person
|
||||
*/
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public final class BundleCommandBuilder
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(sink, "byte sink is required");
|
||||
logger.info("bundle {} to byte sink");
|
||||
logger.info("bundle {} to byte sink", sink);
|
||||
|
||||
return bundleCommand.bundle(new BundleCommandRequest(sink));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package sonia.scm.util;
|
||||
|
||||
public class CRLFInjectionException extends IllegalArgumentException{
|
||||
|
||||
public CRLFInjectionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -344,8 +344,7 @@ public final class HttpUtil
|
||||
"parameter \"{}\" contains a character which could be an indicator for a crlf injection",
|
||||
parameter);
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
"parameter contains an illegal character");
|
||||
throw new CRLFInjectionException("parameter contains an illegal character");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,19 @@ public class VndMediaType {
|
||||
private static final String SUBTYPE_PREFIX = "vnd.scmm-";
|
||||
public static final String PREFIX = TYPE + "/" + SUBTYPE_PREFIX;
|
||||
public static final String SUFFIX = "+json;v=" + VERSION;
|
||||
public static final String PLAIN_TEXT_PREFIX = "text/" + SUBTYPE_PREFIX;
|
||||
public static final String PLAIN_TEXT_SUFFIX = "+plain;v=" + VERSION;
|
||||
|
||||
public static final String USER = PREFIX + "user" + SUFFIX;
|
||||
public static final String GROUP = PREFIX + "group" + SUFFIX;
|
||||
public static final String REPOSITORY = PREFIX + "repository" + SUFFIX;
|
||||
public static final String PERMISSION = PREFIX + "permission" + SUFFIX;
|
||||
public static final String CHANGESET = PREFIX + "changeset" + SUFFIX;
|
||||
public static final String CHANGESET_COLLECTION = PREFIX + "changesetCollection" + SUFFIX;
|
||||
public static final String TAG = PREFIX + "tag" + SUFFIX;
|
||||
public static final String TAG_COLLECTION = PREFIX + "tagCollection" + SUFFIX;
|
||||
public static final String BRANCH = PREFIX + "branch" + SUFFIX;
|
||||
public static final String DIFF = PLAIN_TEXT_PREFIX + "diff" + PLAIN_TEXT_SUFFIX;
|
||||
public static final String USER_COLLECTION = PREFIX + "userCollection" + SUFFIX;
|
||||
public static final String GROUP_COLLECTION = PREFIX + "groupCollection" + SUFFIX;
|
||||
public static final String REPOSITORY_COLLECTION = PREFIX + "repositoryCollection" + SUFFIX;
|
||||
|
||||
Reference in New Issue
Block a user