package org.sonar.server.scanner;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.sonar.api.server.ws.Request;
}
private static void setLastAnalysisDate(WsProjectResponse.Builder response, ProjectRepositories data) {
- if (data.lastAnalysisDate() != null) {
- response.setLastAnalysisDate(data.lastAnalysisDate().getTime());
+ Date lastAnalysisDate = data.lastAnalysisDate();
+ if (lastAnalysisDate != null) {
+ response.setLastAnalysisDate(lastAnalysisDate.getTime());
}
}
import java.util.List;
import java.util.Map;
import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
import org.sonar.api.web.UserRole;
import org.sonar.batch.protocol.input.FileData;
import org.sonar.batch.protocol.input.ProjectRepositories;
@ServerSide
public class ProjectDataLoader {
- private static final Logger LOG = Loggers.get(ProjectDataLoader.class);
-
private final DbClient dbClient;
private final UserSession userSession;
package org.sonar.server.util;
public class ObjectUtils {
+ private ObjectUtils() {
+ // static utility methods only
+ }
/**
* Taken from http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/src-html/org/apache/commons/lang3/ObjectUtils.html#line.119
+ *
* <p>Returns the first value in the array which is not {@code null}.
* If all the values are {@code null} or the array is {@code null}
* or empty then {@code null} is returned.</p>
import javax.annotation.Nullable;
import org.apache.commons.lang.mutable.MutableBoolean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
import org.sonar.batch.analysis.DefaultAnalysisMode;
import org.sonar.batch.cache.WSLoader;
import org.sonar.batch.cache.WSLoaderResult;
public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoader {
- private static final Logger LOG = LoggerFactory.getLogger(DefaultProjectRepositoriesLoader.class);
+ private static final Logger LOG = Loggers.get(DefaultProjectRepositoriesLoader.class);
private static final String BATCH_PROJECT_URL = "/scanner/project";
private final WSLoader wsLoader;
}
url += "&preview=" + analysisMode.isIssues();
- ProjectRepositories projectRepositories = load(url, fromCache);
- return projectRepositories;
+ return load(url, fromCache);
}
private ProjectRepositories load(String resource, @Nullable MutableBoolean fromCache) {
WSLoaderResult<String> result = wsLoader.loadString(resource);
- if(fromCache != null) {
+ if (fromCache != null) {
fromCache.setValue(result.isFromCache());
}
return ProjectRepositories.fromJson(result.get());