verify(componentIndexer).execute(fs);
}
+ @Test
+ public void should_not_fail_with_null_basedir() throws Exception {
+ // This is the case with views
+ when(initializer.baseDir()).thenReturn(null);
+ DefaultModuleFileSystem fs = new DefaultModuleFileSystem(moduleInputFileCache, ProjectDefinition.create(),
+ new Project("foo"), settings, fileIndexer, initializer, componentIndexer);
+ }
+
}
package org.sonar.api.batch.fs.internal;
import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import org.sonar.api.batch.fs.FilePredicate;
import org.sonar.api.batch.fs.FilePredicates;
}
protected DefaultFileSystem(File baseDir, Cache cache) {
- Preconditions.checkNotNull(baseDir, "Base directory can't be null");
- this.baseDir = baseDir.getAbsoluteFile();
+ // Basedir can be null with views
+ this.baseDir = baseDir != null ? baseDir.getAbsoluteFile() : new File(".");
this.cache = cache;
this.predicates = new DefaultFilePredicates(baseDir);
}