import java.io.File;
import java.util.Collection;
import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+import java.util.concurrent.*;
public class SonarBridgeEngine extends CpdEngine {
filtered = null;
LOG.warn("Timeout during detection of duplications for " + file, e);
} catch (InterruptedException e) {
- throw new SonarException(e);
+ throw new SonarException("Fail during detection of duplication for "+ file, e);
} catch (ExecutionException e) {
- throw new SonarException(e);
+ throw new SonarException("Fail during detection of duplication for "+ file, e);
}
SonarEngine.save(context, resource, filtered);
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.PersistenceMode;
-import org.sonar.api.resources.Java;
-import org.sonar.api.resources.JavaFile;
-import org.sonar.api.resources.Language;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
+import org.sonar.api.resources.*;
import org.sonar.api.scan.filesystem.FileQuery;
import org.sonar.api.scan.filesystem.ModuleFileSystem;
import org.sonar.api.scan.filesystem.PathResolver;
import javax.annotation.Nullable;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStreamReader;
-import java.io.Reader;
+import java.io.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+import java.util.concurrent.*;
public class SonarEngine extends CpdEngine {
reader = new InputStreamReader(new FileInputStream(file), fileSystem.sourceCharset());
statements = statementChunker.chunk(tokenChunker.chunk(reader));
} catch (FileNotFoundException e) {
- throw new SonarException(e);
+ throw new SonarException("Cannot find file "+ file, e);
} finally {
IOUtils.closeQuietly(reader);
}
clones = null;
LOG.warn("Timeout during detection of duplications for " + file, e);
} catch (InterruptedException e) {
- throw new SonarException(e);
+ throw new SonarException("Fail during detection of duplication for "+ file, e);
} catch (ExecutionException e) {
- throw new SonarException(e);
+ throw new SonarException("Fail during detection of duplication for "+ file, e);
}
save(context, resource, clones);