List of usage examples for java.util Locale ROOT
Locale ROOT
To view the source code for java.util Locale ROOT.
Click Source Link
From source file:br.ufrj.ppgi.jemf.mobile.bean.AffectedOrganization.java
/** * Set the level as String value. * @param level */ public void setLevelString(String level) { setLevel(EnumLevel.valueOf(level.toUpperCase(Locale.ROOT))); }
From source file:org.apache.solr.client.solrj.impl.Krb5HttpClientBuilder.java
public SolrHttpClientBuilder getBuilder(SolrHttpClientBuilder builder) { if (System.getProperty(LOGIN_CONFIG_PROP) != null) { String configValue = System.getProperty(LOGIN_CONFIG_PROP); if (configValue != null) { logger.info("Setting up SPNego auth with config: " + configValue); final String useSubjectCredsProp = "javax.security.auth.useSubjectCredsOnly"; String useSubjectCredsVal = System.getProperty(useSubjectCredsProp); // "javax.security.auth.useSubjectCredsOnly" should be false so that the underlying // authentication mechanism can load the credentials from the JAAS configuration. if (useSubjectCredsVal == null) { System.setProperty(useSubjectCredsProp, "false"); } else if (!useSubjectCredsVal.toLowerCase(Locale.ROOT).equals("false")) { // Don't overwrite the prop value if it's already been written to something else, // but log because it is likely the Credentials won't be loaded correctly. logger.warn("System Property: " + useSubjectCredsProp + " set to: " + useSubjectCredsVal + " not false. SPNego authentication may not be successful."); }//from w ww . ja va 2 s . c o m javax.security.auth.login.Configuration.setConfiguration(jaasConfig); //Enable only SPNEGO authentication scheme. builder.setAuthSchemeRegistryProvider(() -> { Lookup<AuthSchemeProvider> authProviders = RegistryBuilder.<AuthSchemeProvider>create() .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(true, false)).build(); return authProviders; }); // Get the credentials from the JAAS configuration rather than here Credentials useJaasCreds = new Credentials() { public String getPassword() { return null; } public Principal getUserPrincipal() { return null; } }; HttpClientUtil.setCookiePolicy(SolrPortAwareCookieSpecFactory.POLICY_NAME); builder.setCookieSpecRegistryProvider(() -> { SolrPortAwareCookieSpecFactory cookieFactory = new SolrPortAwareCookieSpecFactory(); Lookup<CookieSpecProvider> cookieRegistry = RegistryBuilder.<CookieSpecProvider>create() .register(SolrPortAwareCookieSpecFactory.POLICY_NAME, cookieFactory).build(); return cookieRegistry; }); builder.setDefaultCredentialsProvider(() -> { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, useJaasCreds); return credentialsProvider; }); HttpClientUtil.addRequestInterceptor(bufferedEntityInterceptor); } } return builder; }
From source file:com.gargoylesoftware.htmlunit.general.HostExtractor.java
private static void ensure(final File file, final Set<String> set) throws IOException { final Set<String> unusedNames = new HashSet<>(set); final List<String> lines = FileUtils.readLines(file); for (final String line : lines) { for (final Iterator<String> it = unusedNames.iterator(); it.hasNext();) { if (line.contains("(\"" + it.next() + "\")")) { it.remove();//from w w w .j av a 2 s . co m } } } unusedNames.remove("this"); unusedNames.remove("Boolean"); unusedNames.remove("null"); if (!unusedNames.isEmpty()) { for (final String name : unusedNames) { if (name.contains(" ")) { continue; } System.out.println(""); System.out.println(" /**"); System.out.println(" * @throws Exception if the test fails"); System.out.println(" */"); System.out.println(" @Test"); System.out.println(" @Alerts(\"exception\")"); String methodName = name; for (final String prefix : PREFIXES_) { if (methodName.startsWith(prefix)) { methodName = prefix.toLowerCase(Locale.ROOT) + methodName.substring(prefix.length()); break; } } if (Character.isUpperCase(methodName.charAt(0))) { methodName = Character.toLowerCase(methodName.charAt(0)) + methodName.substring(1); } methodName = methodName.replace(".", "_"); System.out.println(" public void " + methodName + "() throws Exception {"); System.out.println(" test(\"" + name + "\");"); System.out.println(" }"); } } for (final String name : unusedNames) { if (name.contains(" ")) { System.out.println("Ignoring: " + name); } } }
From source file:ch.cyberduck.ui.cocoa.datasource.TransferTableDataSource.java
/** * @param searchString Filter hostname or file *///from w w w . j av a 2 s . c o m public void setFilter(final String searchString) { if (StringUtils.isBlank(searchString)) { // Revert to the default filter this.filter = new NullTransferFilter(); } else { // Setting up a custom filter this.filter = new TransferFilter() { @Override public boolean accept(final Transfer transfer) { // Match for path names and hostname for (TransferItem root : transfer.getRoots()) { if (root.remote.getName().toLowerCase(Locale.ROOT) .contains(searchString.toLowerCase(Locale.ROOT))) { return true; } } if (transfer.getSource().getHostname().toLowerCase(Locale.ROOT) .contains(searchString.toLowerCase(Locale.ROOT))) { return true; } return false; } }; } }
From source file:org.apache.solr.cloud.TestPullReplica.java
private String suggestedCollectionName() { return (getTestClass().getSimpleName().replace("Test", "") + "_" + getTestName().split(" ")[0]) .replaceAll("(.)(\\p{Upper})", "$1_$2").toLowerCase(Locale.ROOT); }
From source file:com.gargoylesoftware.htmlunit.httpclient.HtmlUnitExpiresHandler.java
@Override public void parse(final SetCookie cookie, String value) throws MalformedCookieException { if (value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); }// w w w . j ava2s .c o m value = value.replaceAll("[ ,:-]+", " "); Date startDate = null; String[] datePatterns = DEFAULT_DATE_PATTERNS; if (null != browserVersion_) { if (browserVersion_.hasFeature(HTTP_COOKIE_START_DATE_1970)) { startDate = HtmlUnitBrowserCompatCookieSpec.DATE_1_1_1970; } if (browserVersion_.hasFeature(HTTP_COOKIE_EXTENDED_DATE_PATTERNS_1)) { datePatterns = EXTENDED_DATE_PATTERNS_1; } if (browserVersion_.hasFeature(HTTP_COOKIE_EXTENDED_DATE_PATTERNS_2)) { final Calendar calendar = Calendar.getInstance(Locale.ROOT); calendar.setTimeZone(DateUtils.GMT); calendar.set(1969, Calendar.JANUARY, 1, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); startDate = calendar.getTime(); datePatterns = EXTENDED_DATE_PATTERNS_2; } } final Date expiry = DateUtils.parseDate(value, datePatterns, startDate); cookie.setExpiryDate(expiry); }
From source file:com.puppycrawl.tools.checkstyle.internal.AllChecksTest.java
@Test public void testDefaultTokensAreSubsetOfAcceptableTokens() throws Exception { for (Class<?> check : CheckUtil.getCheckstyleChecks()) { if (Check.class.isAssignableFrom(check)) { final Check testedCheck = (Check) check.getDeclaredConstructor().newInstance(); final int[] defaultTokens = testedCheck.getDefaultTokens(); final int[] acceptableTokens = testedCheck.getAcceptableTokens(); if (!isSubset(defaultTokens, acceptableTokens)) { final String errorMessage = String.format(Locale.ROOT, "%s's default tokens must be a subset" + " of acceptable tokens.", check.getName()); Assert.fail(errorMessage); }//from ww w .j a v a2 s . c om } } }
From source file:crawlercommons.sitemaps.SiteMapParserSAXTest.java
@Test public void testFullDateFormat() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm+hh:00", Locale.ROOT); Date date = new Date(); LOG.info(format.format(date));/*from w w w . ja v a 2 s .com*/ LOG.info(SiteMap.getFullDateFormat().format(date)); }
From source file:org.apache.solr.util.stats.InstrumentedHttpRequestExecutor.java
private static String methodNameString(HttpRequest request) { return request.getRequestLine().getMethod().toLowerCase(Locale.ROOT) + ".requests"; }