List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:info.rmapproject.webapp.utils.WebappUtils.java
/** * Replace the namespace URL with something more readable. * * @param url the url/*from w w w .java 2 s. c o m*/ * @return the shortened term that uses the prefix. */ public static String replaceNamespace(String url) { try { URI uri = new URI(url); String path = null; String term = null; String newUrl = url; if (url.contains("#")) { term = uri.getFragment(); path = url.substring(0, url.lastIndexOf("#") + 1); } else if (url.contains("/") && path == null) { term = url.substring(url.lastIndexOf("/") + 1); path = url.substring(0, url.lastIndexOf("/") + 1); } if (term != null && path != null && term.length() > 0 && path.length() > 0) { String prefix = null; try { prefix = prefixes.getMessage(path, null, Locale.ENGLISH); } catch (NoSuchMessageException e) { // null prefix handled below } if (prefix != null && prefix.length() > 0) { newUrl = prefix + ":" + term; } else { newUrl = "x" + ":" + term; } } return newUrl; } catch (URISyntaxException e) { //it's not a uri... that's OK, send it back... return url; } }
From source file:com.flexive.rest.client.RemoteMapSimple.java
public RemoteDataSimple get(String path) { Map<String, Object> current = root; final String[] parts = splitPath(path); RemoteDataSimple parent = new RemoteDataSimple(this, "/", root, null); for (int i = 0; i < parts.length; i++) { final String name = forceUppercase ? parts[i].toUpperCase(Locale.ENGLISH) : parts[i]; final Object value = current.get(name); parent = new RemoteDataSimple(this, name, value, parent); if (i == parts.length - 1) { return parent; }//from w w w. j a va 2s. c o m if (value == null) { return null; } if (!(value instanceof Map)) { throw new IllegalArgumentException("Not a group attribute: " + name + " in " + path); } current = (Map<String, Object>) value; } return null; }
From source file:it_minds.dk.eindberetningmobil_android.models.Purpose.java
/** * saveToJson description and lastUsed here * * @return JSONObject//from w ww. ja va 2 s. com */ public JSONObject saveToJson() { SafeJsonHelper result = new SafeJsonHelper(); result.put("Description", description); Format f = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH); String date = f.format(lastUsed); result.put("Date", date); return result; }
From source file:net.mikaboshi.intra_mart.tools.log_stats.parser.ExceptionLogParserV7Test.java
() throws ParseException { String logText = StringUtils.join(new String[] { "log.generating.time=Sun Nov 13 15:55:39 KST 2011", "log.level=ERROR", "log.logger.name=jp.co.intra_mart.system.javascript.imapi.ResinDataSourceConfiguraterObject", "log.id=5i0slu795nope", "log.thread.id=http-APP:localhost:8088-8088-0$312771783", "log.thread.group=main", "log.message=JNDI??(jdbc/oracle)???????", "",// www . j a va2 s. co m "jp.co.intra_mart.foundation.database.exception.DataSourceConfigurationException: JNDI??(jdbc/oracle)???????", "\tat jp.co.intra_mart.foundation.database.ResinDataSourceConfigurater.bind(ResinDataSourceConfigurater.java:111)", "\tat jp.co.intra_mart.system.javascript.imapi.ResinDataSourceConfiguraterObject.jsFunction_bind(ResinDataSourceConfiguraterObject.java:152)" }, IOUtils.LINE_SEPARATOR); ExceptionLogParser exceptionLogParser = new ExceptionLogParserV7(new ParserParameter()); ExceptionLog log = exceptionLogParser.parse(logText); assertEquals( new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH).parse("Sun Nov 13 15:55:39 KST 2011"), log.date); assertEquals(Level.ERROR, log.level); assertEquals("jp.co.intra_mart.system.javascript.imapi.ResinDataSourceConfiguraterObject", log.logger); assertEquals("5i0slu795nope", log.logId); assertEquals("http-APP:localhost:8088-8088-0$312771783", log.thread); assertEquals("main", log.logThreadGroup); assertEquals("JNDI??(jdbc/oracle)???????", log.message); assertEquals("jp.co.intra_mart.foundation.database.exception.DataSourceConfigurationException: JNDI??(jdbc/oracle)???????", log.getFirstLineOfStackTrace()); }
From source file:org.cleverbus.core.common.ws.component.ErrorAwareWebServiceMessageReceiverHandlerAdapter.java
@Override protected void handleInvalidXmlException(HttpServletRequest req, HttpServletResponse res, Object handler, InvalidXmlException ex) throws Exception { WebServiceConnection connection = new MyHttpServletConnection(req, res); TransportContext previousTransportContext = TransportContextHolder.getTransportContext(); TransportContextHolder.setTransportContext(new DefaultTransportContext(connection)); try {/* w w w. ja v a 2s . c o m*/ MessageContext messageContext = new DefaultMessageContext(getMessageFactory().createWebServiceMessage(), getMessageFactory()); SoapBody soapBody = ((SoapMessage) messageContext.getResponse()).getSoapBody(); soapBody.addServerOrReceiverFault(getFaultString(ex), Locale.ENGLISH); connection.send(messageContext.getResponse()); } finally { TransportUtils.closeConnection(connection); TransportContextHolder.setTransportContext(previousTransportContext); } }
From source file:de.qaware.chronix.importer.csv.FileImporter.java
/** * Constructs a file importer//from w ww.j a v a 2 s . c o m * * @param dateFormat the date format: long for ms since 1970, 'instant' for java 8 instant, * otherwise simple date format * @param numberLocal the number local, e.g. ENGLISH, GERMAN, ... */ public FileImporter(String dateFormat, String numberLocal, String csvDelimiter) { this.dateFormat = dateFormat; if (dateFormat.equalsIgnoreCase("long")) { longDate = true; } else if (dateFormat.equalsIgnoreCase("instant")) { instantDate = true; } else { sdfDate = true; } if (numberLocal.equalsIgnoreCase("german")) { this.numberLocal = Locale.GERMAN; } else { this.numberLocal = Locale.ENGLISH; } this.csvDelimiter = csvDelimiter; }
From source file:io.seldon.importer.articles.dynamicextractors.FirstElementTextValueDateDynamicExtractor.java
@Override public String extract(AttributeDetail attributeDetail, String url, Document articleDoc) throws Exception { String attrib_value = null;//from ww w .j a va 2 s. c o m if ((attributeDetail.extractor_args != null) && (attributeDetail.extractor_args.size() >= 1)) { String cssSelector = attributeDetail.extractor_args.get(0); Element element = articleDoc.select(cssSelector).first(); if (StringUtils.isNotBlank(cssSelector)) { if (element != null) { attrib_value = element.text(); } } } if (attrib_value != null) { String pubtext = attrib_value; SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df = new SimpleDateFormat("dd/mm/yyyy hh:mm", Locale.ENGLISH); Date result = null; try { result = df.parse(pubtext); } catch (ParseException e) { logger.info("Failed to parse date withUTC format " + pubtext); } // try a simpler format df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); try { result = df.parse(pubtext); } catch (ParseException e) { logger.info("Failed to parse date " + pubtext); } if (result != null) { attrib_value = dateFormatter.format(result); } else { logger.error("Failed to parse date " + pubtext); } } return attrib_value; }
From source file:net.pms.configuration.RendererConfigurationTest.java
@Before public void setUp() { // Silence all log messages from the PMS code that is being tested LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.reset();/*w w w .j a va 2 s. com*/ // Set locale to EN to ignore translations for renderers Locale.setDefault(Locale.ENGLISH); // Cases that are too generic should not match anything testCases.put("User-Agent: UPnP/1.0 DLNADOC/1.50", null); testCases.put("User-Agent: Unknown Renderer", null); testCases.put("X-Unknown-Header: Unknown Content", null); // From AirPlayer.conf: testCases.put("User-Agent: AirPlayer/1.0.09 CFNetwork/485.13.9 Darwin/11.0.0", "AirPlayer"); testCases.put("User-Agent: Lavf52.54.0", "AirPlayer"); // From BraviaEX.conf: testCases.put("X-AV-Client-Info: av=5.0; cn=\"Sony Corporation\"; mn=\"BRAVIA KDL-32CX520\"; mv=\"1.7\";", "Sony Bravia EX"); // From BraviaHX.conf: testCases.put("X-AV-Client-Info: av=5.0; cn=\"Sony Corporation\"; mn=\"BRAVIA KDL-55HX750\"; mv=\"1.7\";", "Sony Bravia HX"); // From Dlink510.conf: testCases.put("User-Agent: DLNADOC/1.50 INTEL_NMPR/2.1", "D-Link DSM-510"); // From iPad-iPhone.conf: testCases.put("User-Agent: 8player lite 2.2.3 (iPad; iPhone OS 5.0.1; nl_NL)", "iPad / iPhone"); testCases.put("User-Agent: yxplayer2%20lite/1.2.7 CFNetwork/485.13.9 Darwin/11.0.0", "iPad / iPhone"); testCases.put("User-Agent: MPlayer 1.0rc4-4.2.1", "iPad / iPhone"); testCases.put("User-Agent: NSPlayer/4.1.0.3856", "iPad / iPhone"); // From Philips.conf: testCases.put("User-Agent: Allegro-Software-WebClient/4.61 DLNADOC/1.00", "Philips Aurea"); // From PhilipsPFL.conf: testCases.put("User-Agent: Windows2000/0.0 UPnP/1.0 PhilipsIntelSDK/1.4 DLNADOC/1.50", "Philips TV"); // From PS3.conf: testCases.put("User-Agent: PLAYSTATION 3", "PlayStation 3"); testCases.put( "X-AV-Client-Info: av=5.0; cn=\"Sony Computer Entertainment Inc.\"; mn=\"PLAYSTATION 3\"; mv=\"1.0\"", "PlayStation 3"); // From Realtek.conf: // FIXME: Actual conflict here! Popcorn Hour is returned... //testCases.put("User-Agent: POSIX UPnP/1.0 Intel MicroStack/1.0.2718, RealtekMediaCenter, DLNADOC/1.50", "Realtek"); testCases.put("User-Agent: RealtekVOD neon/0.27.2", "Realtek"); // From SamsungAllShare.conf: testCases.put("User-Agent: SEC_HHP_[HT]D5500/1.0", "Samsung AllShare"); testCases.put("User-Agent: SEC_HHP_[TV]UE32D5000/1.0", "Samsung AllShare"); testCases.put("User-Agent: SEC_HHP_ Family TV/1.0", "Samsung AllShare"); testCases.put("User-Agent: SEC_HHP_[TV]PS51D6900/1.0", "Samsung AllShare"); testCases.put("User-Agent: DLNADOC/1.50 SEC_HHP_[TV]UE32D5000/1.0", "Samsung AllShare"); testCases.put("User-Agent: DLNADOC/1.50 SEC_HHP_[TV]UN55D6050/1.0", "Samsung AllShare"); testCases.put("User-Agent: DLNADOC/1.50 SEC_HHP_ Family TV/1.0", "Samsung AllShare"); // From Samsung-SMT-G7400.conf: testCases.put("User-Agent: Linux/2.6.35 UPnP/1.0 NDS_MHF DLNADOC/1.50", "Samsung SMT-G7400"); // From WDTVLive.conf: testCases.put("User-Agent: INTEL_NMPR/2.1 DLNADOC/1.50 Intel MicroStack/1.0.1423", "WD TV Live"); // From XBMC.conf: testCases.put("User-Agent: XBMC/10.0 r35648 (Mac OS X; 11.2.0 x86_64; http://www.xbmc.org)", "XBMC"); testCases.put("User-Agent: Platinum/0.5.3.0, DLNADOC/1.50", "XBMC"); }
From source file:org.agorava.twitter.jackson.TweetDeserializer.java
@Override public Tweet deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = jp.readValueAsTree(); long id = tree.get("id").asLong(); String text = tree.get("text").asText(); JsonNode fromUserNode = tree.get("user"); String fromScreenName = null; long fromId = 0; String fromImageUrl = null;// w w w.j a va2 s .c o m String dateFormat = TIMELINE_DATE_FORMAT; if (fromUserNode != null) { fromScreenName = fromUserNode.get("screen_name").asText(); fromId = fromUserNode.get("id").asLong(); fromImageUrl = fromUserNode.get("profile_image_url").asText(); } else { fromScreenName = tree.get("from_user").asText(); fromId = tree.get("from_user_id").asLong(); fromImageUrl = tree.get("profile_image_url").asText(); dateFormat = SEARCH_DATE_FORMAT; } Date createdAt = toDate(tree.get("created_at").asText(), new SimpleDateFormat(dateFormat, Locale.ENGLISH)); String source = tree.get("source").asText(); JsonNode toUserIdNode = tree.get("in_reply_to_user_id"); Long toUserId = toUserIdNode != null ? toUserIdNode.longValue() : null; JsonNode languageCodeNode = tree.get("iso_language_code"); String languageCode = languageCodeNode != null ? languageCodeNode.asText() : null; Tweet tweet = new Tweet(id, text, createdAt, fromScreenName, fromImageUrl, toUserId, fromId, languageCode, source); JsonNode inReplyToStatusIdNode = tree.get("in_reply_to_status_id"); Long inReplyToStatusId = inReplyToStatusIdNode != null && !inReplyToStatusIdNode.isNull() ? inReplyToStatusIdNode.longValue() : null; tweet.setInReplyToStatusId(inReplyToStatusId); JsonNode retweetCountNode = tree.get("retweet_count"); Integer retweetCount = retweetCountNode != null && !retweetCountNode.isNull() ? retweetCountNode.intValue() : null; tweet.setRetweetCount(retweetCount); JsonNode favoritedNode = tree.get("favorited"); boolean favorited = favoritedNode != null && !favoritedNode.isNull() ? favoritedNode.booleanValue() : false; tweet.setFavorited(favorited); jp.skipChildren(); return tweet; }
From source file:io.crate.integrationtests.SQLHttpIntegrationTest.java
@Before public void setup() { HttpServerTransport httpServerTransport = internalCluster().getInstance(HttpServerTransport.class); address = ((InetSocketTransportAddress) httpServerTransport.boundAddress().publishAddress()).address(); httpPost = new HttpPost(String.format(Locale.ENGLISH, "http://%s:%s/_sql?error_trace", address.getHostName(), address.getPort())); }