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:com.puppycrawl.tools.checkstyle.checks.TranslationCheck.java
/** * Forms a name of translation file which is missing. * @param fullBundleName full bundle name. * @param languageCode language code./* w ww .java 2 s . c o m*/ * @return name of translation file which is missing. */ private String formMissingTranslationName(String fullBundleName, String languageCode) { final String extension = getFileExtensions()[0]; return String.format(Locale.ROOT, "%s_%s%s", fullBundleName, languageCode, extension); }
From source file:business.security.control.OwmClient.java
/** * Find current station weather report// w w w . j a v a2 s .co m * * @param stationId is the ID of the station * @throws JSONException if the response from the OWM server can't be parsed * @throws IOException if there's some network error or the OWM server * replies with a error. */ public StatusWeatherData currentWeatherAtStation(int stationId) throws IOException, JSONException { String subUrl = String.format(Locale.ROOT, "weather/station/%d?type=json", Integer.valueOf(stationId)); JSONObject response = doQuery(subUrl); return new StatusWeatherData(response); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.java
/** * Gets the property defined as event handler (not necessary a Function if something else has been set). * @param eventName the event name (e.g. "onclick") * @return the property//from w ww . java 2 s.c om */ protected Object getEventHandlerProp(final String eventName) { if (eventListenersContainer_ == null) { return null; } final String name = StringUtils.substring(eventName.toLowerCase(Locale.ROOT), 2); return eventListenersContainer_.getEventHandlerProp(name); }
From source file:com.gargoylesoftware.htmlunit.runners.TestCaseCorrector.java
private static void addMethodWithExpectation(final List<String> lines, int i, final String browserString, final String methodName, final ComparisonFailure comparisonFailure, final String defaultExpectations) { String parent = methodName;//from w ww. j a va 2s .c om final String child = parent.substring(parent.lastIndexOf('_') + 1); final int index = parent.indexOf('_', 1); if (index != -1) { parent = parent.substring(1, index); } else { parent = parent.substring(1); } if (!lines.get(i).isEmpty()) { i++; } lines.add(i++, ""); lines.add(i++, " /**"); lines.add(i++, " * @throws Exception if the test fails"); lines.add(i++, " */"); lines.add(i++, " @Test"); lines.add(i++, " @Alerts(DEFAULT = \"" + defaultExpectations + "\","); lines.add(i++, " " + browserString + " = " + getActualString(comparisonFailure) + ")"); if (index != -1) { lines.add(i++, " public void _" + parent + "_" + child + "() throws Exception {"); lines.add(i++, " test(\"" + parent + "\", \"" + child + "\");"); } else { String method = parent; for (final String prefix : HostExtractor.PREFIXES_) { if (method.startsWith(prefix)) { method = prefix.toLowerCase(Locale.ROOT) + method.substring(prefix.length()); break; } } if (Character.isUpperCase(method.charAt(0))) { method = Character.toLowerCase(method.charAt(0)) + method.substring(1); } lines.add(i++, " public void " + method + "() throws Exception {"); lines.add(i++, " test(\"" + parent + "\");"); } lines.add(i++, " }"); lines.add(i++, "}"); while (lines.size() > i) { lines.remove(i); } }
From source file:com.android.talkback.labeling.LabelProvider.java
/** * Deletes a label in the labels database. * * @param uri The URI matching {code LABELS_ID_CONTENT_URI} that represents * the specific label to delete. * @param selection The WHERE clause for the query. * @param selectionArgs The arguments for the WHERE clause of the query. * @return The number of rows affected./*from www . j av a2 s . c o m*/ */ @Override public int delete(Uri uri, String selection, String[] selectionArgs) { if (uri == null) { LogUtils.log(this, Log.WARN, NULL_URI_FORMAT_STRING); return 0; } if (!UserManagerCompat.isUserUnlocked(getContext())) { return 0; } switch (sUriMatcher.match(uri)) { case LABELS: { initializeDatabaseIfNull(); int result = mDatabase.delete(LabelsTable.TABLE_NAME, selection, selectionArgs); getContext().getContentResolver().notifyChange(uri, null /* observer */); return result; } case LABELS_ID: { initializeDatabaseIfNull(); final String labelIdString = uri.getLastPathSegment(); final int labelId; try { labelId = Integer.parseInt(labelIdString); } catch (NumberFormatException e) { LogUtils.log(this, Log.WARN, UNKNOWN_URI_FORMAT_STRING, uri); return 0; } final String where = String.format(Locale.ROOT, "%s = %d", LabelsTable.KEY_ID, labelId); final int result = mDatabase.delete(LabelsTable.TABLE_NAME, combineSelectionAndWhere(selection, where), selectionArgs); getContext().getContentResolver().notifyChange(uri, null /* observer */); return result; } default: LogUtils.log(this, Log.WARN, UNKNOWN_URI_FORMAT_STRING, uri); return 0; } }
From source file:ch.cyberduck.core.ftp.FTPClient.java
/** * Query the server for a supported feature with particular value, * for example "AUTH SSL" or "AUTH TLS". * Caches the parsed response to avoid resending the command repeatedly. * * @param feature the name of the feature; it is converted to upper case. * @param value the value to find./*w ww . j a v a 2 s. c o m*/ * @return {@code true} if the feature is present, {@code false} if the feature is not present * or the {@link #feat()} command failed. Check {@link #getReplyCode()} or {@link #getReplyString()} * if it is necessary to distinguish these cases. * @throws IOException * @since 3.0 */ public boolean hasFeature(String feature, String value) throws IOException { if (!initFeatureMap()) { return false; } Set<String> entries = features.get(feature.toUpperCase(Locale.ROOT)); if (entries != null) { return entries.contains(value); } return false; }
From source file:net.radai.beanz.util.ReflectionUtil.java
public static String propNameFrom(Method method) { String methodName = method.getName(); if (methodName.startsWith("get") || methodName.startsWith("set")) { if (methodName.length() > 4) { return methodName.substring(3, 4).toLowerCase(Locale.ROOT) + methodName.substring(4); } else {/* w w w. j a v a 2 s . c om*/ return methodName.substring(3, 4).toLowerCase(Locale.ROOT); } } if (methodName.startsWith("is")) { if (methodName.length() > 3) { return methodName.substring(2, 3).toLowerCase(Locale.ROOT) + methodName.substring(3); } else { return methodName.substring(2, 3).toLowerCase(Locale.ROOT); } } throw new IllegalArgumentException("method name " + methodName + " does not contain a property name"); }
From source file:net.sf.yal10n.analyzer.ExploratoryEncodingTest.java
/** * Test to load a resource bundle via Spring's message source when the file * is encoded with a BOM and the correct encoding is used. * @throws Exception any error/* w w w.j a va2 s . com*/ */ @Test public void testSpringMessageSourceBOM() throws Exception { ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource(); source.setBasename("UTF8BOM"); source.setDefaultEncoding("UTF-8-BOM"); source.setFallbackToSystemLocale(false); Assert.assertEquals("first key", source.getMessage("testkey1", null, Locale.ROOT)); Assert.assertEquals("second key", source.getMessage("testkey2", null, Locale.ROOT)); Assert.assertEquals("This file is encoded as UTF-8 with BOM .", source.getMessage("description", null, Locale.ROOT)); }
From source file:com.puppycrawl.tools.checkstyle.MainTest.java
@Test public void testExistingTargetFileXmlOutput() throws Exception { exit.checkAssertionAfterwards(new Assertion() { @Override/* ww w. j a v a 2s . c o m*/ public void checkAssertion() throws IOException { String currentPath = new File(".").getCanonicalPath(); String expectedPath = currentPath + "/src/test/resources/com/puppycrawl/tools/checkstyle/InputMain.java".replace("/", File.separator); final ResourceBundle compilationProperties = ResourceBundle.getBundle("checkstylecompilation"); String version = compilationProperties.getString("checkstyle.compile.version"); assertEquals(String.format(Locale.ROOT, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n" + "<checkstyle version=\"%s\">%n" + "<file name=\"%s\">%n" + "</file>%n" + "</checkstyle>%n", version, expectedPath), systemOut.getLog()); assertEquals("", systemErr.getLog()); } }); Main.main("-c", "src/test/resources/com/puppycrawl/tools/checkstyle/config-classname.xml", "-f", "xml", "src/test/resources/com/puppycrawl/tools/checkstyle/InputMain.java"); }
From source file:com.gargoylesoftware.htmlunit.CodeStyleTest.java
private boolean isSvnPropertiesDefined(final File file) { try {/*from w w w. jav a2 s.com*/ final AtomicBoolean eol = new AtomicBoolean(); svnWCClient_.doGetProperty(file, null, SVNRevision.WORKING, SVNRevision.WORKING, SVNDepth.EMPTY, new ISVNPropertyHandler() { @Override public void handleProperty(final long revision, final SVNPropertyData property) { // nothing to do } @Override public void handleProperty(final SVNURL url, final SVNPropertyData property) { // nothing to do } @Override public void handleProperty(final File path, final SVNPropertyData property) { final String name = property.getName(); final String value = property.getValue().getString(); if ("svn:eol-style".equals(name) && "native".equals(value)) { eol.set(true); } } }, null); final String fileName = file.getName().toLowerCase(Locale.ROOT); for (final String extension : SVN.getEolExtenstions()) { if (fileName.endsWith(extension)) { return eol.get(); } } return true; } catch (final Exception e) { //nothing } final String path = file.getAbsolutePath(); // automatically generated and is outside SVN control return (path.contains("jQuery") && path.contains("WEB-INF") && path.contains("cgi")) || (path.contains("jQuery") && path.contains("csp.log")); }