List of usage examples for java.util Locale US
Locale US
To view the source code for java.util Locale US.
Click Source Link
From source file:com.miserablemind.butter.apps.butterApp.controller.guest.LoginController.java
/** * Method that handles "/login" page/*from w w w.j av a2 s. c o m*/ * * @param user autowired current user to determine if it is already logged in * @param model model to add properties (error in this case) to the view * @param loginError request parameter "error" that Spring Security passes in case log in fails * @return logical view name for the log in template */ @RequestMapping(method = RequestMethod.GET) public String showLoginForm(@ActiveUser AppUser user, ModelMap model, @RequestParam(value = "error", required = false) String loginError) { if (null != user) return "redirect:" + "/"; if (null != loginError) { model.addAttribute("loginError", messageSource.getMessage("LoginForm.BadCredentials", null, Locale.US)); } return "guest/login"; }
From source file:com.aqnote.app.wifianalyzer.wifi.graph.channel.ChannelAxisLabelTest.java
@Before public void setUp() { settings = MainContextHelper.INSTANCE.getSettings(); when(this.settings.getCountryCode()).thenReturn(Locale.US.getCountry()); fixture = new ChannelAxisLabel(WiFiBand.GHZ2, WiFiBand.GHZ2.getWiFiChannels().getWiFiChannelPairs().get(0)); }
From source file:li.barter.http.JsonUtils.java
/** * Gets the field type for a particular key * //ww w . jav a2 s . co m * @param jsonObject The {@link JSONObject} to check the key * @param key The key to check * @return what kind of type the field is, represented as a * {@link FieldType} object * @throws JSONException If the key is not present, or the value is * <code>null</code> */ public static FieldType getTypeForKey(final JSONObject jsonObject, final String key) throws JSONException { if (jsonObject.isNull(key)) { throw new JSONException(String.format(Locale.US, NULL_VALUE_FORMAT_OBJECT, key)); } final Object object = jsonObject.get(key); if (object instanceof Long) { return FieldType.LONG; } else if (object instanceof Integer) { return FieldType.INT; } else if (object instanceof Boolean) { return FieldType.BOOL; } else if (object instanceof String) { return FieldType.STRING; } else if (object instanceof Double) { return FieldType.DOUBLE; } else if (object instanceof JSONObject) { return FieldType.OBJECT; } else if (object instanceof JSONArray) { return FieldType.ARRAY; } throw new JSONException(String.format(Locale.US, UNKNOWN_TYPE, object.getClass().getName())); }
From source file:ch.ralscha.extdirectspring.controller.RouterControllerFormLoadTest.java
@BeforeClass public static void beforeTest() { Locale.setDefault(Locale.US); }
From source file:com.vk.sdk.api.httpClient.VKMultipartEntity.java
public VKMultipartEntity(File[] files) { mBoundary = String.format(Locale.US, VK_BOUNDARY, new Random().nextInt()); mFiles = files; }
From source file:com.salesmanager.core.module.impl.application.currencies.USDCurrencyModule.java
public String getMeasure(BigDecimal measure, String currencycode) throws Exception { NumberFormat nf = null;//from www . ja va 2s. co m nf = NumberFormat.getInstance(Locale.US); nf.setMaximumFractionDigits(1); nf.setMinimumFractionDigits(1); measure.setScale(1, BigDecimal.ROUND_HALF_UP); return nf.format(measure); }
From source file:org.cloudfoundry.identity.uaa.web.ForwardAwareInternalResourceViewResolverTests.java
@Test public void testResolveNonForward() throws Exception { resolver.setApplicationContext(new GenericApplicationContext()); View view = resolver.resolveViewName("foo", Locale.US); assertNotNull(view);/*from w ww .j av a2 s . co m*/ }
From source file:com.tesobe.obp.transport.json.DecoderNov2016.java
@Override public Response get(Transport.Target t, String response) { if (nonNull(response) && !response.equals("null")) { try {//w w w. j av a2s. c o m JSONObject wrapper = new JSONObject(response); if (t != null) { Transport.Target s = wrapper.optEnum(Transport.Target.class, "target", null); if (s == null || s != t) { return new ErrorResponse( String.format(Locale.US, "Targets do not match: request %s response %s", s, t)); } } String error = wrapper.optString("error", null); if (error == null) { JSONArray data = wrapper.optJSONArray("data"); int count = wrapper.optInt("count", 0); boolean more = "more".equals(wrapper.optString("pager")); String state = wrapper.optString("state", null); List<Data> result = nonNull(data) ? data(data) : Collections.emptyList(); return new ValidResponse(count, more, result, state); } return new ErrorResponse(error); } catch (JSONException e) { log.error("{}", response); log.trace("{}", response, e); return new ErrorResponse(e.getMessage()); } } return new ErrorResponse("Empty response received!"); }
From source file:com.kenshoo.freemarker.view.FreeMarkerOnlineView.java
private static List<SelectionOption> toLocaleSelectionOptions(Map<String, Locale> localeMap) { ArrayList<SelectionOption> selectionOptions = new ArrayList<SelectionOption>(localeMap.size()); for (Map.Entry<String, Locale> ent : localeMap.entrySet()) { Locale locale = ent.getValue(); selectionOptions.add(new SelectionOption(ent.getKey(), truncate(locale.getDisplayName(Locale.US), 18) + "; " + locale.toString())); }/*from w w w . j a va2 s . com*/ Collections.sort(selectionOptions); return selectionOptions; }
From source file:Main.java
public static boolean isRIFFFile(String in) { return in.toLowerCase(Locale.US).endsWith(".avi"); }