List of usage examples for org.apache.commons.lang3 StringUtils EMPTY
String EMPTY
To view the source code for org.apache.commons.lang3 StringUtils EMPTY.
Click Source Link
From source file:com.tesshu.subsonic.client.sample4_music_andmovie.StreamDownloadApplication.java
@Bean protected CommandLineRunner run(RestTemplate restTemplate) throws Exception { return args -> { SearchResult2 result2 = search2.get("e", null, null, null, null, 1, null, null); List<Child> songs = result2.getSongs(); File tmpDirectory = new File(tmpPath); tmpDirectory.mkdir();// w w w . ja v a 2 s . c o m int maxBitRate = 256; for (Child song : songs) { streamController.stream(song, maxBitRate, format, null, null, null, null, (subject, inputStream, contentLength) -> { File dir = new File( tmpPath + "/" + song.getPath().replaceAll("([^/]+?)?$", StringUtils.EMPTY)); dir.mkdirs(); File file = new File(tmpPath + "/" + song.getPath().replaceAll("([^.]+?)?$", StringUtils.EMPTY) + format); try { FileOutputStream fos = new FileOutputStream(file); BufferedInputStream reader = new BufferedInputStream(inputStream); byte buf[] = new byte[256]; int len; while ((len = reader.read(buf)) != -1) { fos.write(buf, 0, len); } fos.flush(); fos.close(); reader.close(); inputStream.close(); } catch (IOException e) { e.printStackTrace(); } }); } }; }
From source file:lineage2.gameserver.model.instances.residences.dominion.OutpostInstance.java
@Override public void onSpawn() { super.onSpawn(); Circle c = new Circle(getLoc(), 250); c.setZmax(World.MAP_MAX_Z);/* ww w . j av a 2 s .c o m*/ c.setZmin(World.MAP_MIN_Z); StatsSet set = new StatsSet(); set.set("name", StringUtils.EMPTY); set.set("type", Zone.ZoneType.Dummy); set.set("territory", new Territory().add(c)); _zone = new Zone(new ZoneTemplate(set)); _zone.setReflection(ReflectionManager.DEFAULT); _zone.addListener(new OnZoneEnterLeaveListenerImpl()); _zone.setActive(true); }
From source file:com.aqnote.app.wifianalyzer.vendor.model.VendorServiceTest.java
@Test public void testFindWithNameNotFound() throws Exception { // execute// ww w. jav a2 s. c om String actual = fixture.findVendorName(MAC_IN_RANGE1); when(database.find(MAC_IN_RANGE1)).thenReturn(null); // validate verify(database).find(MAC_IN_RANGE1); verify(remoteCall).execute(MAC_IN_RANGE1); assertEquals(StringUtils.EMPTY, actual); assertSame(StringUtils.EMPTY, actual); }
From source file:ch.cyberduck.core.b2.B2AuthorizedUrlProvider.java
@Override public DescriptiveUrl toDownloadUrl(final Path file, final Void none, final PasswordCallback callback) throws BackgroundException { if (file.isVolume()) { return DescriptiveUrl.EMPTY; }/*from ww w . ja v a 2 s .co m*/ if (file.isFile()) { final String download = String.format("%s/file/%s/%s", session.getClient().getDownloadUrl(), URIEncoder.encode(containerService.getContainer(file).getName()), URIEncoder.encode(containerService.getKey(file))); try { final int seconds = 604800; // Determine expiry time for URL final Calendar expiry = Calendar.getInstance(TimeZone.getTimeZone("UTC")); expiry.add(Calendar.SECOND, seconds); final String token = session.getClient() .getDownloadAuthorization(new B2FileidProvider(session) .getFileid(containerService.getContainer(file), new DisabledListProgressListener()), StringUtils.EMPTY, seconds); return new DescriptiveUrl(URI.create(String.format("%s?Authorization=%s", download, token)), DescriptiveUrl.Type.signed, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Pre-Signed", "S3")) + " (" + MessageFormat.format(LocaleFactory.localizedString("Expires {0}", "S3") + ")", UserDateFormatterFactory.get().getMediumFormat(expiry.getTimeInMillis()))); } catch (B2ApiException e) { throw new B2ExceptionMappingService().map(e); } catch (IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } return DescriptiveUrl.EMPTY; }
From source file:de.blizzy.documentr.web.search.SearchController.java
@RequestMapping(value = "/page", method = RequestMethod.GET) @PreAuthorize("permitAll") public String findPages(@RequestParam("q") String searchText, @RequestParam(value = "p", required = false) Integer page, Authentication authentication, Model model) throws IOException { if (page == null) { page = 1;/*from w ww. j a va 2 s . c o m*/ } // TODO: why can authentication be null here? if (authentication == null) { authentication = authenticationFactory.create(UserStore.ANONYMOUS_USER_LOGIN_NAME); } try { SearchResult result = pageIndex.findPages(searchText, page, authentication); model.addAttribute("searchText", searchText); //$NON-NLS-1$ model.addAttribute("searchResult", result); //$NON-NLS-1$ model.addAttribute("page", page); //$NON-NLS-1$ } catch (ParseException e) { log.warn(StringUtils.EMPTY, e); } catch (TimeoutException e) { return ErrorController.timeout(); } return "/search/result"; //$NON-NLS-1$ }
From source file:ch.cyberduck.core.BookmarkNameProviderTest.java
@Test public void testToStringDefaultHostname() throws Exception { final TestProtocol protocol = new TestProtocol(Scheme.file) { @Override/*from w w w .j a v a2 s .co m*/ public String getName() { return "P"; } @Override public String getDefaultHostname() { return "default"; } }; assertEquals("default \u2013 P", BookmarkNameProvider.toString(new Host(protocol, StringUtils.EMPTY), true)); assertEquals("default \u2013 P", BookmarkNameProvider.toString(new Host(protocol, StringUtils.EMPTY), false)); }
From source file:com.oneops.cms.crypto.CmsCryptoDESTest.java
@Test public void testEmptyString() throws Exception { String decryptedText = crypto.decrypt(CmsCrypto.ENC_PREFIX); Assert.assertTrue(StringUtils.EMPTY.equals(decryptedText)); }
From source file:models.CodeCommentThreadTest.java
@Test public void checkDefaultValueForPrevCommitId() { // given/*w w w . j a v a 2 s . c o m*/ CodeCommentThread codeCommentThread = new CodeCommentThread(); codeCommentThread.createdDate = JodaDateUtil.now(); codeCommentThread.commitId = "1234568"; codeCommentThread.project = project; codeCommentThread.save(); Long id = codeCommentThread.id; // when CodeCommentThread savedCodeCommentThread = CodeCommentThread.find.byId(id); // then assertThat(savedCodeCommentThread.prevCommitId).isEqualTo(StringUtils.EMPTY); }
From source file:com.qwazr.externalizor.SimpleLang.java
public SimpleLang() { emptyString = StringUtils.EMPTY; stringValue = RandomStringUtils.randomAscii(8); stringNullValue = null;/*from w ww. j a va 2 s . com*/ stringArray = new String[RandomUtils.nextInt(5, 20)]; stringArray[0] = null; for (int i = 1; i < stringArray.length; i++) stringArray[i] = RandomStringUtils.randomAscii(5); stringList = new ArrayList(Arrays.asList(stringArray)); intLangValue = RandomUtils.nextInt(); intNullValue = null; intArray = new Integer[RandomUtils.nextInt(5, 20)]; intArray[0] = null; for (int i = 1; i < intArray.length; i++) intArray[i] = RandomUtils.nextInt(); intList = new ArrayList(Arrays.asList(intArray)); shortLangValue = (short) RandomUtils.nextInt(0, Short.MAX_VALUE); shortNullValue = null; shortArray = new Short[RandomUtils.nextInt(5, 20)]; shortArray[0] = null; for (int i = 1; i < shortArray.length; i++) shortArray[i] = (short) RandomUtils.nextInt(0, Short.MAX_VALUE); shortList = new ArrayList(Arrays.asList(shortArray)); longLangValue = RandomUtils.nextLong(); longNullValue = null; longArray = new Long[RandomUtils.nextInt(5, 20)]; longArray[0] = null; for (int i = 1; i < longArray.length; i++) longArray[i] = RandomUtils.nextLong(); longList = new ArrayList(Arrays.asList(longArray)); floatLangValue = (float) RandomUtils.nextFloat(); floatNullValue = null; floatArray = new Float[RandomUtils.nextInt(5, 20)]; floatArray[0] = null; for (int i = 1; i < floatArray.length; i++) floatArray[i] = RandomUtils.nextFloat(); floatList = new ArrayList(Arrays.asList(floatArray)); doubleLangValue = RandomUtils.nextDouble(); doubleNullValue = null; doubleArray = new Double[RandomUtils.nextInt(5, 20)]; doubleArray[0] = null; for (int i = 1; i < doubleArray.length; i++) doubleArray[i] = RandomUtils.nextDouble(); doubleList = new ArrayList(Arrays.asList(doubleArray)); booleanLangValue = RandomUtils.nextInt(0, 1) == 0; booleanNullValue = null; booleanArray = new Boolean[RandomUtils.nextInt(5, 20)]; booleanArray[0] = null; for (int i = 1; i < booleanArray.length; i++) booleanArray[i] = RandomUtils.nextBoolean(); booleanList = new ArrayList(Arrays.asList(booleanArray)); byteLangValue = (byte) RandomUtils.nextInt(0, Byte.MAX_VALUE); byteNullValue = null; byteArray = new Byte[RandomUtils.nextInt(5, 20)]; byteArray[0] = null; for (int i = 1; i < byteArray.length; i++) byteArray[i] = (byte) RandomUtils.nextInt(0, Byte.MAX_VALUE); byteList = new ArrayList(Arrays.asList(byteArray)); charLangValue = (char) RandomUtils.nextInt(0, Character.MAX_VALUE); charNullValue = null; charArray = new Character[RandomUtils.nextInt(5, 20)]; charArray[0] = null; for (int i = 1; i < charArray.length; i++) charArray[i] = (char) RandomUtils.nextInt(0, Character.MAX_VALUE); charList = new ArrayList(Arrays.asList(charArray)); enumNull = null; enumValue = RandomUtils.nextInt(0, 1) == 0 ? EnumType.on : EnumType.off; enumArray = new EnumType[RandomUtils.nextInt(5, 20)]; enumArray[0] = null; for (int i = 1; i < enumArray.length; i++) enumArray[i] = RandomUtils.nextInt(0, 1) == 0 ? EnumType.on : EnumType.off; enumList = new ArrayList(Arrays.asList(enumArray)); }
From source file:com.walmart.gatling.commons.AgentConfig.java
public String getGenericUrl(String path, String queryStringKey, String queryStringValue) { String host = logServer.getHostName(); if (StringUtils.isEmpty(logServer.getHostName())) { try {//from ww w .j ava2 s. c o m host = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { ; } } String result = StringUtils.EMPTY; final String ENCODING = "UTF-8"; try { result = String.format("http://%s:%s/%s?%s=%s", host, Integer.toString(logServer.getPort()), path, queryStringKey, URLEncoder.encode(queryStringValue, ENCODING)); } catch (UnsupportedEncodingException e) { ; } return result; }