}
private int getReadTimeout() {
- return userProperties.properties().containsKey(SONAR_WS_TIMEOUT_PROPS) ? Integer.parseInt(userProperties.property(SONAR_WS_TIMEOUT_PROPS)) * 1000 : DEFAULT_READ_TIMEOUT;
+ return userProperties.properties().containsKey(SONAR_WS_TIMEOUT_PROPS) ? (Integer.parseInt(userProperties.property(SONAR_WS_TIMEOUT_PROPS)) * 1000) : DEFAULT_READ_TIMEOUT;
}
@Nonnull
if (result == null) {
throw new NotAvailableException("resource not cached");
}
- return new WSLoaderResult<T>(result, true);
+ return new WSLoaderResult<>(result, true);
}
@Nonnull
try {
T t = loader.load(id);
switchToOnline();
- return new WSLoaderResult<T>(t, false);
+ return new WSLoaderResult<>(t, false);
} catch (IllegalStateException e) {
if (e.getCause() instanceof HttpException) {
// fail fast if it could connect but there was a application-level error
*/
public class DefaultModuleFileSystem extends DefaultFileSystem implements ModuleFileSystem {
- private final String moduleKey;
- private final FileIndexer indexer;
- private final Settings settings;
+ private String moduleKey;
+ private FileIndexer indexer;
+ private Settings settings;
private File buildDir;
private List<File> sourceDirsOrFiles = Lists.newArrayList();
public DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, Project project,
Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer, ComponentIndexer componentIndexer, DefaultAnalysisMode mode) {
super(initializer.baseDir(), moduleInputFileCache);
- this.componentIndexer = componentIndexer;
- this.moduleKey = project.getKey();
- this.settings = settings;
- this.indexer = indexer;
- setWorkDir(initializer.workingDir());
- this.buildDir = initializer.buildDir();
- this.sourceDirsOrFiles = initializer.sources();
- this.testDirsOrFiles = initializer.tests();
- this.binaryDirs = initializer.binaryDirs();
-
- // filter the files that sensors have access to (SONAR-6931)
- if (!mode.scanAllFiles()) {
- setDefaultPredicate(predicates.not(predicates.hasStatus(Status.SAME)));
- }
+ setFields(project, settings, indexer, initializer, componentIndexer, mode);
}
@VisibleForTesting
public DefaultModuleFileSystem(Project project,
Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer, ComponentIndexer componentIndexer, DefaultAnalysisMode mode) {
super(initializer.baseDir().toPath());
+ setFields(project, settings, indexer, initializer, componentIndexer, mode);
+ }
+
+ private void setFields(Project project,
+ Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer, ComponentIndexer componentIndexer, DefaultAnalysisMode mode) {
this.componentIndexer = componentIndexer;
this.moduleKey = project.getKey();
this.settings = settings;
this.sourceDirsOrFiles = initializer.sources();
this.testDirsOrFiles = initializer.tests();
this.binaryDirs = initializer.binaryDirs();
-
+
// filter the files sensors have access to
if (!mode.scanAllFiles()) {
setDefaultPredicate(predicates.not(predicates.hasStatus(Status.SAME)));