*/
public final class CoberturaUtils {
- public static String COBERTURA_GROUP_ID = MavenUtils.GROUP_ID_CODEHAUS_MOJO;
- public static String COBERTURA_ARTIFACT_ID = "cobertura-maven-plugin";
+ public static final String COBERTURA_GROUP_ID = MavenUtils.GROUP_ID_CODEHAUS_MOJO;
+ public static final String COBERTURA_ARTIFACT_ID = "cobertura-maven-plugin";
public static File getReport(Project project) {
File report = getReportFromProperty(project);
return plot;
}
- private void configureValues(DefaultCategoryDataset dataset, String[] series, String xSuffix) {
+ static void configureValues(DefaultCategoryDataset dataset, String[] series, String xSuffix) {
int index = 0;
while (index < series.length) {
String[] pairs = StringUtils.split(series[index], ";");
case 2: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2; break;
case 3: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3; break;
case 4: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4; break;
- case 5: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5; break;
+ case 5: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5; break;// NOSONAR false-positive: constant 5 is the same than 4 (empty string)
}
return conf.getString(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + index, defaultValue);
}
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
public class CPD {
private int minimumTileSize;
private MatchAlgorithm matchAlgorithm;
private Language language;
- private boolean skipDuplicates;
- public static boolean debugEnable = false;
private boolean loadSourceCodeSlices = true;
private String encoding = System.getProperty("file.encoding");
this.language = language;
}
- public void skipDuplicates() {
- this.skipDuplicates = true;
- }
-
public void setCpdListener(CPDListener cpdListener) {
this.listener = cpdListener;
}
}
private void addDirectory(String dir, boolean recurse) throws IOException {
- if ( !(new File(dir)).exists()) {
+ if (!(new File(dir)).exists()) {
throw new FileNotFoundException("Couldn't find directory " + dir);
}
FileFinder finder = new FileFinder();
add(finder.findFilesFrom(dir, language.getFileFilter(), recurse));
}
- private Set<String> current = new HashSet<String>();
-
private void add(int fileCount, File file) throws IOException {
-
- if (skipDuplicates) {
- // TODO refactor this thing into a separate class
- String signature = file.getName() + '_' + file.length();
- if (current.contains(signature)) {
- System.err.println("Skipping " + file.getAbsolutePath()
- + " since it appears to be a duplicate file and --skip-duplicate-files is set");
- return;
- }
- current.add(signature);
- }
-
- if ( !file.getCanonicalPath().equals(new File(file.getAbsolutePath()).getCanonicalPath())) {
- System.err.println("Skipping " + file + " since it appears to be a symlink");
+ if (!file.getCanonicalPath().equals(new File(file.getAbsolutePath()).getCanonicalPath())) {
+ System.out.println("Skipping " + file + " since it appears to be a symlink");
return;
}
*/
package org.sonar.graph;
+import org.apache.commons.lang.ArrayUtils;
+
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.Reader;
private void readRow(int i) throws IOException {
String[] tokens = splitLine(reader.readLine());
- if (tokens != null) {
- for (int j = 1; j < tokens.length - 1; j++) {
- int toVertexIndex = j - 1;
- int weight = extractWeight(tokens[j]);
- if (i != toVertexIndex) {
- StringEdge edge = new StringEdge(vertices[toVertexIndex], vertices[i], weight);
- if (isFeedbackEdge(tokens[j])) {
- feedbackEdges.add(edge);
- }
- graph.addEdge(edge);
+ for (int j = 1; j < tokens.length - 1; j++) {
+ int toVertexIndex = j - 1;
+ int weight = extractWeight(tokens[j]);
+ if (i != toVertexIndex) {
+ StringEdge edge = new StringEdge(vertices[toVertexIndex], vertices[i], weight);
+ if (isFeedbackEdge(tokens[j])) {
+ feedbackEdges.add(edge);
}
+ graph.addEdge(edge);
}
}
}
}
private String[] splitLine(String line) {
+ if (line == null) {
+ return ArrayUtils.EMPTY_STRING_ARRAY;
+ }
String[] tokens = line.split("\\" + CELL_SEPARATOR);
String[] result = new String[tokens.length];
for (int i = 0; i < tokens.length; i++) {
if (values != null && values.length() > 0) {
StringTokenizer st = new StringTokenizer(values, ",");
while (st.hasMoreTokens()) {
- double v_x = convertParamToDouble(st.nextToken());
- double v_y = 0.0;
+ double vX = convertParamToDouble(st.nextToken());
+ double vY = 0.0;
if (st.hasMoreTokens()) {
- v_y = convertParamToDouble(st.nextToken());
+ vY = convertParamToDouble(st.nextToken());
}
- series1.add(v_x, v_y);
+ series1.add(vX, vY);
- min = (v_y < min ? v_y : min);
- max = (v_y > max ? v_y : max);
+ min = (vY < min ? vY : min);
+ max = (vY > max ? vY : max);
}
dataset.addSeries(series1);
y.setRange(min-1, max+1);
return libs;
}
- private static String[] IGNORE = { "derby", "jtds", "mysql", "postgresql", "jruby", "jfreechart", "eastwood", "jetty" };
+ private static final String[] IGNORE = { "derby", "jtds", "mysql", "postgresql", "jruby", "jfreechart", "eastwood", "jetty" };
/**
* Dirty hack to disable downloading for certain files.
*/
public abstract class WSUtils {
- private static WSUtils INSTANCE = null;
+ private static WSUtils instance = null;
public static void setInstance(WSUtils utils) {
- INSTANCE = utils;
+ instance = utils;
}
public static WSUtils getINSTANCE() {
- return INSTANCE;
+ return instance;
}
public abstract String format(Date date, String format);