Example usage for java.util Locale ROOT

List of usage examples for java.util Locale ROOT

Introduction

In this page you can find the example usage for java.util Locale ROOT.

Prototype

Locale ROOT

To view the source code for java.util Locale ROOT.

Click Source Link

Document

Useful constant for the root locale.

Usage

From source file:Main.java

@NonNull
private static String appendToAcceptLanguage(@NonNull String acceptLanguage, @NonNull String languageCode,
        float quality) {
    // If accept-language already contains the language, just return accept-language.
    if (acceptLanguage.contains(languageCode)) {
        return acceptLanguage;
    }// w  w w . j a  v a  2s. com

    // If accept-language is empty, don't append. Just return the language.
    if (acceptLanguage.isEmpty()) {
        return languageCode;
    }

    // Accept-language is nonempty, append the language.
    return String.format(Locale.ROOT, "%s,%s;q=%.1f", acceptLanguage, languageCode, quality);
}

From source file:com.qiongsong.ficus.dal.internal.DDLFormatterImpl.java

@Override
public String format(String sql) {
    if (StringUtils.isEmpty(sql)) {
        return sql;
    }//from  www .  jav  a  2 s .c o  m
    if (sql.toLowerCase(Locale.ROOT).startsWith("create table")) {
        return formatCreateTable(sql);
    } else if (sql.toLowerCase(Locale.ROOT).startsWith("alter table")) {
        return formatAlterTable(sql);
    } else if (sql.toLowerCase(Locale.ROOT).startsWith("comment on")) {
        return formatCommentOn(sql);
    } else {
        return "\n    " + sql;
    }
}

From source file:com.digitalpebble.stormcrawler.protocol.HttpRobotRulesParser.java

/**
 * Compose unique key to store and access robot rules in cache for given URL
 *//*  w ww.  ja  va  2s.c  o  m*/
protected static String getCacheKey(URL url) {
    String protocol = url.getProtocol().toLowerCase(Locale.ROOT);
    String host = url.getHost().toLowerCase(Locale.ROOT);

    int port = url.getPort();
    if (port == -1) {
        port = url.getDefaultPort();
    }
    /*
     * Robot rules apply only to host, protocol, and port where robots.txt
     * is hosted (cf. NUTCH-1752). Consequently
     */
    String cacheKey = protocol + ":" + host + ":" + port;
    return cacheKey;
}

From source file:ch.cyberduck.core.http.PreferencesRedirectCallback.java

@Override
public boolean redirect(final String method) {
    return PreferencesFactory.get()
            .getBoolean(String.format("webdav.redirect.%s.follow", StringUtils.upperCase(method, Locale.ROOT)));
}

From source file:com.gargoylesoftware.htmlunit.runners.TestCaseCorrector.java

static void correct(final FrameworkMethod method, final boolean realBrowser,
        final BrowserVersion browserVersion, final boolean notYetImplemented, final Throwable t)
        throws IOException {
    final String testRoot = "src/test/java/";
    final String browserString = browserVersion.getNickname().toUpperCase(Locale.ROOT);
    final File file = new File(testRoot + method.getDeclaringClass().getName().replace('.', '/') + ".java");
    final List<String> lines = FileUtils.readLines(file);
    final String methodLine = "    public void " + method.getName() + "()";
    if (realBrowser) {
        String defaultExpectation = null;
        for (int i = 0; i < lines.size(); i++) {
            if ("    @Default".equals(lines.get(i))) {
                defaultExpectation = getDefaultExpectation(lines, i);
            }/*  w w  w. j a  v  a  2 s. c o m*/
            if (lines.get(i).startsWith(methodLine)) {
                i = addExpectation(lines, i, browserString, (ComparisonFailure) t);
                break;
            }
            if (i == lines.size() - 2) {
                addMethodWithExpectation(lines, i, browserString, method.getName(), (ComparisonFailure) t,
                        defaultExpectation);
                break;
            }
        }
    } else if (!notYetImplemented) {
        String defaultExpectation = null;
        for (int i = 0; i < lines.size(); i++) {
            if ("    @Default".equals(lines.get(i))) {
                defaultExpectation = getDefaultExpectation(lines, i);
            }
            if (lines.get(i).startsWith(methodLine)) {
                addNotYetImplemented(lines, i, browserString);
                break;
            }
            if (i == lines.size() - 2) {
                addNotYetImplementedMethod(lines, i, browserString, method.getName(), defaultExpectation);
                break;
            }
        }
    } else {
        for (int i = 0; i < lines.size(); i++) {
            if (lines.get(i).startsWith(methodLine)) {
                removeNotYetImplemented(lines, i, browserString);
                break;
            }
        }
    }
    FileUtils.writeLines(file, lines);
}

From source file:ch.cyberduck.ui.browser.SearchFilter.java

@Override
public boolean accept(final Path file) {
    if (file.getName().toLowerCase(Locale.ROOT).contains(input.toLowerCase(Locale.ROOT))) {
        // Matching filename
        return true;
    }/*from   w w w .j  ava2 s  .  c  o  m*/
    if (StringUtils.isNotBlank(file.attributes().getVersionId())) {
        if (file.attributes().getVersionId().toLowerCase(Locale.ROOT)
                .contains(input.toLowerCase(Locale.ROOT))) {
            // Matching version
            return true;
        }
    }
    return false;
}

From source file:at.bitfire.davdroid.webdav.DavHttpRequestRetryHandler.java

@Override
protected boolean handleAsIdempotent(final HttpRequest request) {
    final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
    return ArrayUtils.contains(idempotentMethods, method);
}

From source file:com.digitalpebble.storm.crawler.protocol.http.HttpRobotRulesParser.java

/**
 * Compose unique key to store and access robot rules in cache for given URL
 *///from   ww w .j  av  a2s  . c  om
protected static String getCacheKey(URL url) {
    String protocol = url.getProtocol().toLowerCase(Locale.ROOT); // normalize
                                                                  // to
                                                                  // lower
                                                                  // case
    String host = url.getHost().toLowerCase(Locale.ROOT); // normalize to
                                                          // lower case
    int port = url.getPort();
    if (port == -1) {
        port = url.getDefaultPort();
    }
    /*
     * Robot rules apply only to host, protocol, and port where robots.txt
     * is hosted (cf. NUTCH-1752). Consequently
     */
    String cacheKey = protocol + ":" + host + ":" + port;
    return cacheKey;
}

From source file:com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory.java

/**
 * Indicates whether the ActiveX name is one flavor of XMLDOMDocument.
 * @param name the ActiveX name/*  w  w  w. j av  a  2s . co m*/
 * @return {@code true} if this is an XMLDOMDocument
 */
static boolean isXMLDOMDocument(String name) {
    if (name == null) {
        return false;
    }
    name = name.toLowerCase(Locale.ROOT);
    return "microsoft.xmldom".equals(name) || name.startsWith("msxml2.domdocument")
            || name.startsWith("msxml2.freethreadeddomdocument");
}

From source file:org.springsource.restbucks.payment.web.MoneySerializationTest.java

@Before
public void setUp() {

    this.mapper = new ObjectMapper();
    this.mapper.registerModules(JacksonTestUtils.getModules());

    LocaleContextHolder.setLocale(Locale.ROOT);
}