return builder.build();
}
- private void addAttributeInMb(ProtobufSystemInfo.Section.Builder builder, String key, long valueInBytes) {
+ private static void addAttributeInMb(ProtobufSystemInfo.Section.Builder builder, String key, long valueInBytes) {
if (valueInBytes >= 0L) {
builder.addAttributesBuilder().setKey(key).setLongValue(valueInBytes / MEGABYTE).build();
}
import java.util.Date;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.annotation.CheckForNull;
Date actualCreatedAfter = createdAfter;
if (createdInLast != null) {
- actualCreatedAfter = new DateTime(system.now()).minus(ISOPeriodFormat.standard().parsePeriod("P" + createdInLast.toUpperCase())).toDate();
+ actualCreatedAfter = new DateTime(system.now()).minus(
+ ISOPeriodFormat.standard().parsePeriod("P" + createdInLast.toUpperCase(Locale.ENGLISH))).toDate();
}
return actualCreatedAfter;
}
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
+import java.util.Locale;
import java.util.Set;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.rules.RuleType;
import org.sonar.api.ce.ComputeEngineSide;
+import org.sonar.api.rules.RuleType;
import org.sonar.api.server.ServerSide;
import org.sonar.api.server.rule.RuleTagFormat;
import org.sonar.api.user.User;
}), new Function<String, String>() {
@Override
public String apply(String tag) {
- String lowerCaseTag = tag.toLowerCase();
+ String lowerCaseTag = tag.toLowerCase(Locale.ENGLISH);
RuleTagFormat.validate(lowerCaseTag);
return lowerCaseTag;
}
json.name("statuses").beginObject();
for (RuleStatus status : RuleStatus.values()) {
if (status != RuleStatus.REMOVED) {
- json.prop(status.toString(), i18n.message(Locale.getDefault(), "rules.status." + status.toString().toLowerCase(), status.toString()));
+ json.prop(status.toString(), i18n.message(Locale.getDefault(), "rules.status." + status.toString().toLowerCase(Locale.ENGLISH), status.toString()));
}
}
json.endObject();
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.Nullable;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.RequestHandler;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.text.JsonWriter;
-import javax.annotation.Nullable;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
/**
* This web service lists all the existing web services, including itself,
* for documentation usage.
writer.close();
}
- private void writeController(JsonWriter writer, Controller controller, boolean includeInternals) {
+ private static void writeController(JsonWriter writer, Controller controller, boolean includeInternals) {
if (includeInternals || !controller.isInternal()) {
writer.beginObject();
writer.prop("path", controller.path());
*/
package org.sonar.colorizer;
-import org.sonar.channel.CodeReader;
-
import java.util.Collections;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.sonar.channel.CodeReader;
/**
* @deprecated since 4.5.2 replace by highlighting mechanism
private boolean isKeyword(String word) {
if (!caseInsensitive && keywords.contains(word)) {
return true;
- } else if (caseInsensitive && keywords.contains(word.toUpperCase())) {
+ } else if (caseInsensitive && keywords.contains(word.toUpperCase(Locale.ENGLISH))) {
return true;
}
return false;
import org.picocontainer.lifecycle.ReflectionLifecycleStrategy;
import org.picocontainer.monitors.NullComponentMonitor;
import org.sonar.api.batch.BatchSide;
-import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.ce.ComputeEngineSide;
+import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.server.ServerSide;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
return pico.getComponent(key);
}
+ @Override
public <T> List<T> getComponentsByType(Class<T> tClass) {
return pico.getComponents(tClass);
}
*/
public static ActiveRuleKey parse(String s) {
Preconditions.checkArgument(s.split(":").length >= 3, "Bad format of activeRule key: " + s);
- int semiColonPos = s.indexOf(":");
+ int semiColonPos = s.indexOf(':');
String key = s.substring(0, semiColonPos);
String ruleKey = s.substring(semiColonPos + 1);
return ActiveRuleKey.of(key, RuleKey.parse(ruleKey));
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
}
private String sqlQueryString(String query) {
- return query == null ? "%" : "%" + query.toUpperCase() + "%";
+ return query == null ? "%" : "%" + query.toUpperCase(Locale.ENGLISH) + "%";
}
private static QualityProfileMapper mapper(DbSession session) {
*/
package org.sonar.api.rules;
+import java.util.Locale;
import org.sonar.check.Priority;
/**
@Deprecated
public static RulePriority valueOfString(String level) {
try {
- return RulePriority.valueOf(level.toUpperCase());
+ return RulePriority.valueOf(level.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException ex) {
// backward compatibility
*/
package org.sonar.api.test;
+import java.util.Locale;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
OK, FAILURE, ERROR, SKIPPED;
public static Status of(@Nullable String s) {
- return s == null ? null : valueOf(s.toUpperCase());
+ return s == null ? null : valueOf(s.toUpperCase(Locale.ENGLISH));
}
}
*/
package org.sonar.test;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.*;
-
public class RunTestsMultipleTimes implements TestRule {
final int threads;
final int times;
} catch (RuntimeException e) {
throw e;
} catch (Throwable e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
}));
}
};
}
-}
\ No newline at end of file
+}