use of java.util.Locale in project checkstyle by checkstyle.
the class SuppressWarningsFilterTest method createChecker.
@Override
public Checker createChecker(Configuration checkConfig) throws Exception {
final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration");
final DefaultConfiguration checksConfig = createCheckConfig(TreeWalker.class);
final DefaultConfiguration holderConfig = createCheckConfig(SuppressWarningsHolder.class);
holderConfig.addAttribute("aliasList", "com.puppycrawl.tools.checkstyle.checks.sizes." + "ParameterNumberCheck=paramnum");
checksConfig.addChild(holderConfig);
final DefaultConfiguration memberNameCheckConfig = createCheckConfig(MemberNameCheck.class);
memberNameCheckConfig.addAttribute("id", "ignore");
checksConfig.addChild(memberNameCheckConfig);
final DefaultConfiguration constantNameCheckConfig = createCheckConfig(ConstantNameCheck.class);
constantNameCheckConfig.addAttribute("id", "");
checksConfig.addChild(constantNameCheckConfig);
checksConfig.addChild(createCheckConfig(ParameterNumberCheck.class));
checksConfig.addChild(createCheckConfig(IllegalCatchCheck.class));
final DefaultConfiguration uncommentedMainCheckConfig = createCheckConfig(UncommentedMainCheck.class);
uncommentedMainCheckConfig.addAttribute("id", "ignore");
checksConfig.addChild(uncommentedMainCheckConfig);
checksConfig.addChild(createCheckConfig(JavadocTypeCheck.class));
checkerConfig.addChild(checksConfig);
if (checkConfig != null) {
checkerConfig.addChild(checkConfig);
}
final Checker checker = new Checker();
final Locale locale = Locale.ROOT;
checker.setLocaleCountry(locale.getCountry());
checker.setLocaleLanguage(locale.getLanguage());
checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
checker.configure(checkerConfig);
checker.addListener(new BriefUtLogger(stream));
return checker;
}
use of java.util.Locale in project philm by chrisbanes.
the class AndroidCountryProvider method getTwoLetterCountryCodeFromLocale.
private String getTwoLetterCountryCodeFromLocale() {
final Locale locale = Locale.getDefault();
final String countryCode = locale.getCountry();
if (!TextUtils.isEmpty(countryCode)) {
return countryCode;
}
return null;
}
use of java.util.Locale in project philm by chrisbanes.
the class AndroidCountryProvider method getTwoLetterLanguageCode.
@Override
public String getTwoLetterLanguageCode() {
if (mLanguageCode == null) {
final Locale locale = Locale.getDefault();
mLanguageCode = locale.getLanguage();
}
return mLanguageCode;
}
use of java.util.Locale in project checkstyle by checkstyle.
the class SeverityLevelTest method testMixedCaseSpacesWithDifferentLocales.
@Test
public void testMixedCaseSpacesWithDifferentLocales() {
final Locale[] differentLocales = { new Locale("TR", "tr") };
final Locale defaultLocale = Locale.getDefault();
try {
for (Locale differentLocale : differentLocales) {
Locale.setDefault(differentLocale);
testMixedCaseSpaces();
}
} finally {
Locale.setDefault(defaultLocale);
}
}
use of java.util.Locale in project GCViewer by chewiebug.
the class SimpleGcWriterTest method exportLocaleSv.
@Test
public void exportLocaleSv() throws Exception {
Locale.setDefault(new Locale("sv", "se"));
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
SimpleGcWriter writer = new SimpleGcWriter(outputStream)) {
writer.write(gcModel);
String[] lines = outputStream.toString().split(System.getProperty("line.separator"));
assertEquals("line count", 2, lines.length);
String[] firstLine = lines[0].split(" ");
assertEquals("number of parts in line 1", 3, firstLine.length);
assertEquals("timestamp", "0.677000", firstLine[1]);
}
}
Aggregations