}
private static class LineReaders {
- private final List<LineReader> lineReaders = new ArrayList<>();
- private final List<ReportIterator> reportIterators = new ArrayList<>();
+ private final List<LineReader> readers = new ArrayList<>();
+ private final List<ReportIterator> iterators = new ArrayList<>();
LineReaders(BatchReportReader reportReader, int componentRef) {
File coverageFile = reportReader.readComponentCoverage(componentRef);
if (coverageFile != null) {
ReportIterator<BatchReport.Coverage> coverageReportIterator = new ReportIterator<>(coverageFile, BatchReport.Coverage.PARSER);
- reportIterators.add(coverageReportIterator);
- lineReaders.add(new CoverageLineReader(coverageReportIterator));
+ iterators.add(coverageReportIterator);
+ readers.add(new CoverageLineReader(coverageReportIterator));
}
if (scmReport != null) {
- lineReaders.add(new ScmLineReader(scmReport));
+ readers.add(new ScmLineReader(scmReport));
}
if (highlightingFile != null) {
ReportIterator<BatchReport.SyntaxHighlighting> syntaxHighlightingReportIterator = new ReportIterator<>(highlightingFile, BatchReport.SyntaxHighlighting.PARSER);
- reportIterators.add(syntaxHighlightingReportIterator);
- lineReaders.add(new HighlightingLineReader(syntaxHighlightingReportIterator));
+ iterators.add(syntaxHighlightingReportIterator);
+ readers.add(new HighlightingLineReader(syntaxHighlightingReportIterator));
}
if (!duplications.isEmpty()) {
- lineReaders.add(new DuplicationLineReader(duplications));
+ readers.add(new DuplicationLineReader(duplications));
}
if (!symbols.isEmpty()) {
- lineReaders.add(new SymbolsLineReader(symbols));
+ readers.add(new SymbolsLineReader(symbols));
}
}
List<LineReader> readers() {
- return lineReaders;
+ return readers;
}
void close() {
- for (ReportIterator reportIterator : reportIterators) {
+ for (ReportIterator reportIterator : iterators) {
reportIterator.close();
}
}
import org.sonar.api.utils.log.Loggers;
import org.sonar.process.ProcessProperties;
+import javax.annotation.CheckForNull;
+
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@Override
public void start() {
LOGGER.info("SonarQube home: " + homeDir.getAbsolutePath());
+
+ File deployDir = getDeployDir();
+ if (deployDir == null) {
+ throw new IllegalArgumentException("Web app directory does not exist: " + getDeployDir());
+ }
try {
- if (getDeployDir() == null) {
- throw new IllegalArgumentException("Web app directory does not exist: " + getDeployDir());
- }
- FileUtils.forceMkdir(getDeployDir());
- for (File subDirectory : getDeployDir().listFiles((FileFilter) FileFilterUtils.directoryFileFilter())) {
+ FileUtils.forceMkdir(deployDir);
+ for (File subDirectory : deployDir.listFiles((FileFilter) FileFilterUtils.directoryFileFilter())) {
FileUtils.cleanDirectory(subDirectory);
}
-
} catch (IOException e) {
- throw new IllegalStateException("The following directory can not be created: " + getDeployDir().getAbsolutePath(), e);
+ throw new IllegalStateException("The following directory can not be created: " + deployDir.getAbsolutePath(), e);
}
File deprecated = getDeprecatedPluginsDir();
try {
FileUtils.forceMkdir(deprecated);
FileUtils.cleanDirectory(deprecated);
-
} catch (IOException e) {
throw new IllegalStateException("The following directory can not be created: " + deprecated.getAbsolutePath(), e);
}
return tempDir;
}
+ @CheckForNull
public File getDeployDir() {
return server.getDeployDir();
}
import org.sonar.api.utils.log.Loggers;
import org.sonar.process.ProcessProperties;
+import javax.annotation.CheckForNull;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
}
@Override
+ @CheckForNull
public File getDeployDir() {
return deployDir;
}
import org.sonar.api.platform.ServerStartHandler;
import org.sonar.api.platform.ServerStopHandler;
+import javax.annotation.CheckForNull;
+
import java.io.File;
import java.util.Date;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
public class ServerLifecycleNotifierTest {
}
@Override
+ @CheckForNull
public File getDeployDir() {
return null;
}
*/
package org.sonar.batch.platform;
-import org.sonar.batch.bootstrap.ServerClient;
-
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
+import org.sonar.batch.bootstrap.ServerClient;
+
+import javax.annotation.CheckForNull;
import java.io.File;
import java.text.ParseException;
}
@Override
+ @CheckForNull
public File getDeployDir() {
return null;
}
import org.sonar.api.BatchComponent;
import org.sonar.api.ServerComponent;
+import javax.annotation.CheckForNull;
+
import java.io.File;
import java.util.Date;
public abstract File getRootDir();
+ @CheckForNull
public abstract File getDeployDir();
public abstract String getContextPath();