@@ -57,7 +57,7 @@ public class ProcessStateSystemInfo implements SystemInfoSection { | |||
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(); | |||
} |
@@ -31,6 +31,7 @@ import java.util.Collection; | |||
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; | |||
@@ -160,7 +161,8 @@ public class IssueQueryService { | |||
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; | |||
} |
@@ -28,12 +28,13 @@ import com.google.common.collect.Sets; | |||
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; | |||
@@ -318,7 +319,7 @@ public class IssueUpdater { | |||
}), 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; | |||
} |
@@ -125,7 +125,7 @@ public class AppAction implements RulesWsAction { | |||
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(); |
@@ -21,18 +21,16 @@ package org.sonar.server.ws; | |||
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. | |||
@@ -139,7 +137,7 @@ public class WebServicesWs implements WebService { | |||
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()); |
@@ -19,13 +19,13 @@ | |||
*/ | |||
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 | |||
@@ -79,7 +79,7 @@ public class KeywordsTokenizer extends NotThreadSafeTokenizer { | |||
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; |
@@ -37,8 +37,8 @@ import org.picocontainer.behaviors.OptInCaching; | |||
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; | |||
@@ -276,6 +276,7 @@ public class ComponentContainer implements ContainerPopulator.Container { | |||
return pico.getComponent(key); | |||
} | |||
@Override | |||
public <T> List<T> getComponentsByType(Class<T> tClass) { | |||
return pico.getComponents(tClass); | |||
} |
@@ -52,7 +52,7 @@ public class ActiveRuleKey implements Serializable, Comparable<ActiveRuleKey> { | |||
*/ | |||
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)); |
@@ -26,6 +26,7 @@ import com.google.common.collect.Maps; | |||
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; | |||
@@ -374,7 +375,7 @@ public class QualityProfileDao implements Dao { | |||
} | |||
private String sqlQueryString(String query) { | |||
return query == null ? "%" : "%" + query.toUpperCase() + "%"; | |||
return query == null ? "%" : "%" + query.toUpperCase(Locale.ENGLISH) + "%"; | |||
} | |||
private static QualityProfileMapper mapper(DbSession session) { |
@@ -19,6 +19,7 @@ | |||
*/ | |||
package org.sonar.api.rules; | |||
import java.util.Locale; | |||
import org.sonar.check.Priority; | |||
/** | |||
@@ -46,7 +47,7 @@ public enum RulePriority { | |||
@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 |
@@ -19,6 +19,7 @@ | |||
*/ | |||
package org.sonar.api.test; | |||
import java.util.Locale; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
@@ -31,7 +32,7 @@ public interface TestCase { | |||
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)); | |||
} | |||
} | |||
@@ -19,14 +19,16 @@ | |||
*/ | |||
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; | |||
@@ -57,7 +59,7 @@ public class RunTestsMultipleTimes implements TestRule { | |||
} catch (RuntimeException e) { | |||
throw e; | |||
} catch (Throwable e) { | |||
throw new RuntimeException(e); | |||
throw new IllegalStateException(e); | |||
} | |||
} | |||
})); | |||
@@ -75,4 +77,4 @@ public class RunTestsMultipleTimes implements TestRule { | |||
} | |||
}; | |||
} | |||
} | |||
} |