Skip to content

Commit

Permalink
SONAR-7681 Use public implementation of List in MyBatis
Browse files Browse the repository at this point in the history
  • Loading branch information
teryk committed May 31, 2016
1 parent c06b99f commit 8f24ad8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Expand Up @@ -149,7 +149,6 @@ public void filter_by_max_executed_at_include_day_filled() {
globalAdmin();
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
String today = formatDate(new Date(EXECUTED_AT));
System.out.println(EXECUTED_AT + " - " + today);

ActivityResponse activityResponse = call(ws.newRequest()
.setParam(CeWsParameters.PARAM_MAX_EXECUTED_AT, today));
Expand Down
14 changes: 8 additions & 6 deletions sonar-db/src/main/java/org/sonar/db/ce/CeTaskQuery.java
Expand Up @@ -19,12 +19,13 @@
*/
package org.sonar.db.ce;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.db.DatabaseUtils;

import static java.util.Collections.singletonList;
import static com.google.common.collect.Lists.newArrayList;

/**
* Db Query used for CE_QUEUE and CE_ACTIVITY tables
Expand All @@ -34,8 +35,9 @@ public class CeTaskQuery {
public static final int MAX_COMPONENT_UUIDS = DatabaseUtils.PARTITION_SIZE_FOR_ORACLE;

private boolean onlyCurrents = false;
private List<String> componentUuids;
private List<String> statuses;
// SONAR-7681 a public implementation of List must be used in MyBatis - potential concurrency exceptions otherwise
private ArrayList<String> componentUuids;
private ArrayList<String> statuses;
private String type;
private Long minSubmittedAt;
private Long maxExecutedAt;
Expand All @@ -46,7 +48,7 @@ public List<String> getComponentUuids() {
}

public CeTaskQuery setComponentUuids(@Nullable List<String> l) {
this.componentUuids = l;
this.componentUuids = l == null ? null : newArrayList(l);
return this;
}

Expand All @@ -58,7 +60,7 @@ public CeTaskQuery setComponentUuid(@Nullable String s) {
if (s == null) {
this.componentUuids = null;
} else {
this.componentUuids = singletonList(s);
this.componentUuids = newArrayList(s);
}
return this;
}
Expand All @@ -78,7 +80,7 @@ public List<String> getStatuses() {
}

public CeTaskQuery setStatuses(@Nullable List<String> statuses) {
this.statuses = statuses;
this.statuses = statuses == null ? null : newArrayList(statuses);
return this;
}

Expand Down
Expand Up @@ -21,6 +21,7 @@

import com.google.common.base.Function;
import com.google.common.base.Joiner;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
Expand All @@ -31,15 +32,17 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.FluentIterable.from;
import static com.google.common.collect.Lists.newArrayList;
import static java.util.Objects.requireNonNull;
import static org.sonar.db.DatabaseUtils.buildLikeValue;
import static org.sonar.db.WildcardPosition.AFTER;

public class ComponentTreeQuery {
@CheckForNull
private final String nameOrKeyQuery;
// SONAR-7681 a public implementation of List must be used in MyBatis - potential concurrency exceptions otherwise
@CheckForNull
private final Collection<String> qualifiers;
private final ArrayList<String> qualifiers;
@CheckForNull
private final Integer page;
@CheckForNull
Expand All @@ -51,7 +54,7 @@ public class ComponentTreeQuery {

private ComponentTreeQuery(Builder builder) {
this.nameOrKeyQuery = builder.nameOrKeyQuery;
this.qualifiers = builder.qualifiers;
this.qualifiers = builder.qualifiers == null ? null : newArrayList(builder.qualifiers);
this.page = builder.page;
this.pageSize = builder.pageSize;
this.baseSnapshot = builder.baseSnapshot;
Expand Down

0 comments on commit 8f24ad8

Please sign in to comment.