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:ch.cyberduck.core.ftp.FTPListService.java
public FTPListService(final FTPSession session, final HostPasswordStore keychain, final LoginCallback prompt, final String system, final TimeZone zone) { this.session = session; // Directory listing parser depending on response for SYST command final CompositeFileEntryParser parser = new FTPParserSelector().getParser(system, zone); this.implementations.put(Command.list, new FTPDefaultListService(session, keychain, prompt, parser, Command.list)); if (PreferencesFactory.get().getBoolean("ftp.command.stat")) { if (StringUtils.isNotBlank(system)) { if (!system.toUpperCase(Locale.ROOT).contains(FTPClientConfig.SYST_NT)) { // Workaround for #5572. this.implementations.put(Command.stat, new FTPStatListService(session, parser)); }//from www . j av a 2 s . c om } else { this.implementations.put(Command.stat, new FTPStatListService(session, parser)); } } if (PreferencesFactory.get().getBoolean("ftp.command.mlsd")) { this.implementations.put(Command.mlsd, new FTPMlsdListService(session, keychain, prompt)); } if (PreferencesFactory.get().getBoolean("ftp.command.lista")) { this.implementations.put(Command.lista, new FTPDefaultListService(session, keychain, prompt, parser, Command.lista)); } }
From source file:com.grayfox.server.service.PoiServiceTest.java
@Test @Ignore//w w w. j a v a2 s .c o m @Transactional public void testBuildRoute() { Poi p1 = new Poi(); p1.setFoursquareId("4bad0850f964a52082263be3"); p1.setName("Cinpolis"); p1.setLocation(Location.parse("19.032099226143384,-98.23300838470459")); Category category = new Category(); category.setFoursquareId("4bf58dd8d48988d180941735"); category.setName("Multicine"); category.setIconUrl("https://ss3.4sqi.net/img/categories_v2/arts_entertainment/movietheater_88.png"); p1.setCategories(new HashSet<>(Arrays.asList(category))); Poi p2 = new Poi(); p2.setFoursquareId("4c2b7f8257a9c9b6affff567"); p2.setName("Liverpool"); p2.setLocation(Location.parse("19.03174044908608,-98.23100973086046")); category = new Category(); category.setFoursquareId("4bf58dd8d48988d1f6941735"); category.setName("Gran tienda"); category.setIconUrl("https://ss3.4sqi.net/img/categories_v2/shops/departmentstore_88.png"); p2.setCategories(new HashSet<>(Arrays.asList(category))); List<Poi> expectedPois = Arrays.asList(p1, p2); List<Poi> actualPois = poiService.buildRoute("4c09270ea1b32d7f172297f0", Locale.ROOT); assertThat(actualPois).isNotNull().isNotEmpty().doesNotContainNull().hasSameSizeAs(expectedPois) .containsExactlyElementsOf(expectedPois); ; }
From source file:business.security.control.OwmClient.java
/** * Find current weather around a geographic point * * @param lat is the latitude of the geographic point of interest * (North/South coordinate)/*from w w w .j ava2 s.co m*/ * @param lon is the longitude of the geographic point of interest * (East/West coordinate) * @param cnt is the requested number of weather stations to retrieve (the * actual answer might be less than the requested). * @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 WeatherStatusResponse currentWeatherAroundPoint(float lat, float lon, int cnt) throws IOException, JSONException { //, boolean cluster, OwmClient.Lang lang) { String subUrl = String.format(Locale.ROOT, "find/station?lat=%f&lon=%f&cnt=%d&cluster=yes", Float.valueOf(lat), Float.valueOf(lon), Integer.valueOf(cnt)); JSONObject response = doQuery(subUrl); return new WeatherStatusResponse(response); }
From source file:ch.cyberduck.core.openstack.SwiftUrlProvider.java
@Override public DescriptiveUrlBag toUrl(final Path file) { final DescriptiveUrlBag list = new DescriptiveUrlBag(); if (file.isFile()) { Region region = null;/*from w ww . j ava 2 s .c o m*/ try { region = regionService.lookup(file); } catch (BackgroundException e) { log.warn(String.format("Failure looking up region for %s %s", file, e.getMessage())); } if (null == region) { list.addAll(new DefaultUrlProvider(session.getHost()).toUrl(file)); } else { if (!session.getHost().isDefaultWebURL()) { list.addAll(new WebUrlProvider(session.getHost()).toUrl(file)); } list.add(new DescriptiveUrl( URI.create(region.getStorageUrl(containerService.getContainer(file).getName(), containerService.getKey(file)).toString()), DescriptiveUrl.Type.provider, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), session.getHost().getProtocol().getScheme().name().toUpperCase(Locale.ROOT)))); // In one hour list.addAll(this.sign(region, file, this.getExpiry((int) TimeUnit.HOURS.toSeconds(1)))); // Default signed URL expiring in 24 hours. list.addAll(this.sign(region, file, this.getExpiry((int) TimeUnit.SECONDS .toSeconds(PreferencesFactory.get().getInteger("s3.url.expire.seconds"))))); // 1 Week list.addAll(this.sign(region, file, this.getExpiry((int) TimeUnit.DAYS.toSeconds(7)))); // 1 Month list.addAll(this.sign(region, file, this.getExpiry((int) TimeUnit.DAYS.toSeconds(30)))); // 1 Year list.addAll(this.sign(region, file, this.getExpiry((int) TimeUnit.DAYS.toSeconds(365)))); } } return list; }
From source file:br.ufrj.ppgi.jemf.mobile.bean.AffectedOrganization.java
/** * Set the status as String value./*from w w w. ja va 2 s . com*/ * @param status */ public void setStatusString(String status) { setStatus(EnumOrganizationStatus.valueOf(status.toUpperCase(Locale.ROOT))); }
From source file:eu.trentorise.opendata.commons.test.jackson.JacksonTest.java
/** * Shows that nasty Jackson deserializes "" into null instead of * {@link Locale.ROOT} !!!//from www .j ava 2 s . c o m * */ @Test(expected = AssertionError.class) public void testLocaleDeser() throws JsonProcessingException, IOException { ObjectMapper om = new ObjectMapper(); String json = om.writeValueAsString(new RootLocale()); LOG.log(Level.FINE, "json = {0}", json); RootLocale res = om.readValue(json, RootLocale.class); assertNotNull(res.locale); assertEquals(Locale.ROOT, res.locale); }
From source file:com.ezdi.rtf.testRTFParser.RTFObjDataParser.java
/** * @param bytes/*from ww w .ja va 2 s .c o m*/ * @param metadata * incoming metadata * @param unknownFilenameCount * @return byte[] for contents of obj data * @throws IOException */ protected byte[] parse(byte[] bytes, Metadata metadata, AtomicInteger unknownFilenameCount) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream(bytes); long version = readUInt(is); metadata.add(RTFMetadata.EMB_APP_VERSION, Long.toString(version)); long formatId = readUInt(is); // 2 is an embedded object. 1 is a link. if (formatId != 2L) { return null; } String className = readLengthPrefixedAnsiString(is).trim(); String topicName = readLengthPrefixedAnsiString(is).trim(); String itemName = readLengthPrefixedAnsiString(is).trim(); if (className != null && className.length() > 0) { metadata.add(RTFMetadata.EMB_CLASS, className); } if (topicName != null && topicName.length() > 0) { metadata.add(RTFMetadata.EMB_TOPIC, topicName); } if (itemName != null && itemName.length() > 0) { metadata.add(RTFMetadata.EMB_ITEM, itemName); } long dataSz = readUInt(is); // readBytes tests for reading too many bytes byte[] embObjBytes = readBytes(is, dataSz); if (className.toLowerCase(Locale.ROOT).equals("package")) { return handlePackage(embObjBytes, metadata); } else if (className.toLowerCase(Locale.ROOT).equals("pbrush")) { // simple bitmap bytes return embObjBytes; } else { ByteArrayInputStream embIs = new ByteArrayInputStream(embObjBytes); if (NPOIFSFileSystem.hasPOIFSHeader(embIs)) { try { return handleEmbeddedPOIFS(embIs, metadata, unknownFilenameCount); } catch (IOException e) { // swallow } } } return embObjBytes; }
From source file:ch.cyberduck.core.ftp.FTPClient.java
@Override protected void _prepareDataSocket_(final Socket socket) throws IOException { if (preferences.getBoolean("ftp.tls.session.requirereuse")) { if (socket instanceof SSLSocket) { // Control socket is SSL final SSLSession session = ((SSLSocket) _socket_).getSession(); if (session.isValid()) { final SSLSessionContext context = session.getSessionContext(); context.setSessionCacheSize(preferences.getInteger("ftp.ssl.session.cache.size")); try { final Field sessionHostPortCache = context.getClass() .getDeclaredField("sessionHostPortCache"); sessionHostPortCache.setAccessible(true); final Object cache = sessionHostPortCache.get(context); final Method method = cache.getClass().getDeclaredMethod("put", Object.class, Object.class); method.setAccessible(true); method.invoke(cache, String.format("%s:%s", socket.getInetAddress().getHostName(), String.valueOf(socket.getPort())).toLowerCase(Locale.ROOT), session); method.invoke(cache, String.format("%s:%s", socket.getInetAddress().getHostAddress(), String.valueOf(socket.getPort())).toLowerCase(Locale.ROOT), session); } catch (NoSuchFieldException e) { // Not running in expected JRE log.warn("No field sessionHostPortCache in SSLSessionContext", e); } catch (Exception e) { // Not running in expected JRE log.warn(e.getMessage()); }/*from w ww . j av a 2 s.c o m*/ } else { log.warn(String.format("SSL session %s for socket %s is not rejoinable", session, socket)); } } } }
From source file:com.puppycrawl.tools.checkstyle.JavadocPropertiesGeneratorTest.java
@Test public void testNonExistentArgument() throws Exception { JavadocPropertiesGenerator.main("--nonexistent-argument"); final String expected = String.format(Locale.ROOT, "Missing required options " + "[--destfile=<outputFile>, params[0]=<inputFile>]%n") + USAGE; assertEquals("Unexpected error log", expected, systemErr.getLog()); assertEquals("Unexpected output log", "", systemOut.getLog()); }
From source file:de.ks.text.AsciiDocParser.java
public String parse(String input, boolean removeFooter, boolean addMathJax, String mathjaxDir, OptionsBuilder options) {//from w w w . ja v a 2 s. c o m String render = asciidoctor.get().render(input, options); String backend = (String) options.asMap().get(Options.BACKEND); if (backend.equals(AsciiDocBackend.HTML5.name().toLowerCase(Locale.ROOT))) { if (removeFooter) { render = removeFooter(render); } if (addMathJax) { render = addMathJax(render, mathjaxDir); } render = removeFontLink(render); } return render; }