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:ste.web.http.HttpUtils.java
/** * @param response - NOT NULL/*from w w w .java2s . co m*/ * @param url - NOT EMPTY */ public static void sendTemporaryRedirect(final HttpResponse response, final String url) { if (response == null) { throw new IllegalArgumentException("response can not be null"); } if (StringUtils.isBlank(url)) { throw new IllegalArgumentException("url can not be empty"); } response.setStatusLine(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_TEMPORARY_REDIRECT, EnglishReasonPhraseCatalog.INSTANCE.getReason(HttpStatus.SC_TEMPORARY_REDIRECT, Locale.ENGLISH))); response.setHeader(HttpHeaders.LOCATION, url); }
From source file:org.springframework.social.betaseries.api.impl.json.BSDateAndTimeDeserializer.java
@Override public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { try {/*from w w w . j a va 2 s . c o m*/ return new SimpleDateFormat(BS_DATE_FORMAT, Locale.ENGLISH).parse(jp.getText()); } catch (ParseException e) { return null; } }
From source file:jp.xet.uncommons.web.env.RemoteEnvironmentProfile.java
@Override public String toString() { return name().toLowerCase(Locale.ENGLISH); }
From source file:ca.nines.ise.cmd.Fragment.java
/** * {@inheritDoc}/* www . ja va2 s . co m*/ */ @Override public void execute(CommandLine cmd) throws Exception { PrintStream out; Writer renderer; Locale.setDefault(Locale.ENGLISH); out = new PrintStream(System.out, true, "UTF-8"); renderer = new SGMLWriter(out); String[] files = getArgList(cmd); if (files.length == 0) { System.err.println("At least one document is required."); System.exit(-1); } DOM dom = new DOMBuilder(new File(files[0])).build(); if (dom.getStatus() == DOMStatus.ERROR) { System.err.println("Document contains errors. Cannot continue."); System.exit(-1); } int length = 2; if (cmd.hasOption("n")) { length = Integer.parseInt(cmd.getOptionValue("n")); } String tln = "1"; if (cmd.hasOption("tln")) { tln = cmd.getOptionValue("tln"); } dom = dom.getTlnFragment(tln, length); renderer.render(dom); }
From source file:com.fmguler.ven.LiquibaseUtil.java
/** * Undo all changes in the test database *//*from ww w .j a v a2s . co m*/ public static void rollbackDatabase(String tag) { try { Locale currLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); Database database = DatabaseFactory.getInstance() .findCorrectDatabaseImplementation(getDataSource().getConnection()); Liquibase liquibase = new Liquibase("etc/test-db/test-db-changelog.xml", new FileSystemFileOpener(), database); liquibase.rollback(tag, ""); Locale.setDefault(currLocale); } catch (SQLException ex) { ex.printStackTrace(); } catch (JDBCException ex) { ex.printStackTrace(); } catch (LiquibaseException ex) { ex.printStackTrace(); } }
From source file:org.glowroot.common2.repo.util.Compilations.java
public static Class<?> compile(String source) throws Exception { JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>(); IsolatedClassLoader isolatedClassLoader = new IsolatedClassLoader(); StandardJavaFileManager standardFileManager = javaCompiler.getStandardFileManager(diagnosticCollector, Locale.ENGLISH, UTF_8); standardFileManager.setLocation(StandardLocation.CLASS_PATH, getCompilationClassPath()); JavaFileManager fileManager = new IsolatedJavaFileManager(standardFileManager, isolatedClassLoader); try {//from ww w . j a v a2 s . co m List<JavaFileObject> compilationUnits = Lists.newArrayList(); String className = getPublicClassName(source); int index = className.lastIndexOf('.'); String simpleName; if (index == -1) { simpleName = className; } else { simpleName = className.substring(index + 1); } compilationUnits.add(new SourceJavaFileObject(simpleName, source)); JavaCompiler.CompilationTask task = javaCompiler.getTask(null, fileManager, diagnosticCollector, null, null, compilationUnits); task.call(); List<Diagnostic<? extends JavaFileObject>> diagnostics = diagnosticCollector.getDiagnostics(); if (!diagnostics.isEmpty()) { List<String> compilationErrors = Lists.newArrayList(); for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) { compilationErrors.add(checkNotNull(diagnostic.toString())); } throw new CompilationException(compilationErrors); } if (className.isEmpty()) { throw new CompilationException(ImmutableList.of("Class must be public")); } return isolatedClassLoader.loadClass(className); } finally { fileManager.close(); } }
From source file:org.hawkular.apm.server.api.utils.zipkin.SpanHttpDeriverUtil.java
/** * Method returns list of http status codes. * * @param binaryAnnotations zipkin binary annotations * @return http status codes//from ww w.jav a2 s. c o m */ public static List<HttpCode> getHttpStatusCodes(List<BinaryAnnotation> binaryAnnotations) { if (binaryAnnotations == null) { return Collections.emptyList(); } List<HttpCode> httpCodes = new ArrayList<>(); for (BinaryAnnotation binaryAnnotation : binaryAnnotations) { if (Constants.ZIPKIN_BIN_ANNOTATION_HTTP_STATUS_CODE.equals(binaryAnnotation.getKey()) && binaryAnnotation.getValue() != null) { String strHttpCode = binaryAnnotation.getValue(); Integer httpCode = toInt(strHttpCode.trim()); if (httpCode != null) { String description = EnglishReasonPhraseCatalog.INSTANCE.getReason(httpCode, Locale.ENGLISH); httpCodes.add(new HttpCode(httpCode, description)); } } } return httpCodes; }
From source file:ca.nines.ise.cmd.Abbrs.java
/** * {@inheritDoc}/*from w w w .j a v a 2 s . c o m*/ */ @Override public void execute(CommandLine cmd) throws Exception { File[] files; Locale.setDefault(Locale.ENGLISH); PrintStream out = new PrintStream(System.out, true, "UTF-8"); if (cmd.hasOption("l")) { out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8"); } files = getFilePaths(cmd); Formatter formatter = new Formatter(out); if (files != null) { out.println("Found " + files.length + " files to check."); for (File in : files) { DOM dom = new DOMBuilder(in).build(); for (Node n : dom) { if (n.type() == NodeType.ABBR) { formatter.format("%s:%d:%d%n", n.getSource(), n.getLine(), n.getColumn()); formatter.format(" near TLN %s%n", n.getTLN()); formatter.format(" %s%n", n.getText().substring(0, Math.min(64, n.getText().length()))); formatter.format(" %s%n", dom.getLine(n.getLine() - 1)); formatter.format("%n"); } } } } }
From source file:de.tudarmstadt.ukp.dkpro.argumentation.sequence.report.ReportTools.java
/** * Prints macro F1 and F1 for each label into file (each line: label + F1, tab delimited) * * @param confusionMatrix matrix// w ww . j av a2 s.c o m * @param file file * @throws IOException */ public static void printFMeasuresToFile(ConfusionMatrix confusionMatrix, File file) throws IOException { // and write to the output PrintWriter pw = new PrintWriter(file); // print macro F1 first pw.printf(Locale.ENGLISH, "%s\t%.3f%n", "Macro-Fm", confusionMatrix.getMacroFMeasure()); // then for all labels for (Map.Entry<String, Double> entry : confusionMatrix.getFMeasureForLabels().entrySet()) { pw.printf(Locale.ENGLISH, "%s\t%.3f%n", entry.getKey(), entry.getValue()); } IOUtils.closeQuietly(pw); }
From source file:com.stimulus.archiva.domain.Domains.java
public void addDomain(String domain) { domains.add(new Domain(domain.toLowerCase(Locale.ENGLISH).trim())); }