List of usage examples for org.apache.commons.lang3 StringUtils isNoneBlank
public static boolean isNoneBlank(final CharSequence... css)
Checks if none of the CharSequences are blank ("") or null and whitespace only..
StringUtils.isNoneBlank(null) = false StringUtils.isNoneBlank(null, "foo") = false StringUtils.isNoneBlank(null, null) = false StringUtils.isNoneBlank("", "bar") = false StringUtils.isNoneBlank("bob", "") = false StringUtils.isNoneBlank(" bob ", null) = false StringUtils.isNoneBlank(" ", "bar") = false StringUtils.isNoneBlank("foo", "bar") = true
From source file:gob.dp.simco.comun.FunctionUtil.java
public static String uploadArchive(Part fil) { String nameArchive = getFilename(fil); String extencion = getFileExtension(getFilename(fil)); if (StringUtils.isNoneBlank(nameArchive)) { String formato = RandomStringUtils.random(32, 0, 20, true, true, "qw32rfHIJk9iQ8Ud7h0X".toCharArray()); String ruta = formato + extencion; File file = new File(ConstantesUtil.FILE_SYSTEM + ruta); try (InputStream input = fil.getInputStream()) { Files.copy(input, file.toPath()); } catch (IOException ex) { log.error(ex);// w w w .jav a 2 s . c o m } return ruta; } return null; }
From source file:musiccrawler.common.HtmlToolFix.java
public static String searchStreamLink(String script) { if (StringUtils.isNoneBlank(script)) { Pattern pattern = Pattern.compile(Constant.STREAM_LINK_PATTERN); Matcher matcher = pattern.matcher(script); if (matcher.find()) { return matcher.group(1).trim(); }// w w w . jav a 2 s . com } return Constant.EMPTY; }
From source file:musiccrawler.common.HtmlToolFix.java
public static String fixLinkStream(String input) { if (StringUtils.isNoneBlank(input)) { return StringUtils.replaceAll(input, Constant.FIX_STREAM_PATTERN, Constant.EMPTY).trim(); }/*from w ww .j a v a 2s .co m*/ return Constant.EMPTY; }
From source file:io.cloudex.framework.cloud.api.ApiUtils.java
/** * Return an IOException from the metaData error * @param metaData/*from w w w. j a v a 2 s .co m*/ * @return */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static IOException exceptionFromCloudExError(VmMetaData metaData, String instanceId) { Class clazz = IOException.class; String message = metaData.getMessage(); if (StringUtils.isNoneBlank(metaData.getException())) { try { clazz = Class.forName(metaData.getException()); } catch (ClassNotFoundException e) { log.warn("failed to load exception class from evm"); } } Exception cause; try { Constructor ctor = clazz.getDeclaredConstructor(String.class); ctor.setAccessible(true); cause = (Exception) ctor.newInstance(message); } catch (Exception e) { log.warn("failed to load exception class from evm"); cause = new IOException(message); } return new ProcessorException(PROCESSOR_EXCEPTION + instanceId, cause, instanceId); }
From source file:com.msopentech.odatajclient.engine.utils.QualifiedName.java
public QualifiedName(final String qualifiedName) { if (StringUtils.isNoneBlank(qualifiedName) && !qualifiedName.trim().endsWith(".")) { int lastDotIndex = qualifiedName.lastIndexOf('.'); this.namespace = qualifiedName.substring(0, lastDotIndex > 0 ? lastDotIndex : 0); this.name = qualifiedName.substring(lastDotIndex + 1); } else {/*from ww w . ja va 2s. c o m*/ throw new IllegalArgumentException("Invalid qualified name " + qualifiedName); } }
From source file:net.eledge.android.europeana.gui.notification.receiver.UrlButtonReceiver.java
@Override public void onReceive(Context context, Intent intent) { int notificationId = intent.getIntExtra(PARAM_NOTIFICATIONID, Config.NOTIFICATION_NEWBLOG); String url = intent.getStringExtra(PARAM_URL); if (StringUtils.isNoneBlank(url)) { try {//from ww w . ja v a2s . com PendingIntent.getActivity(context, 0, new Intent(Intent.ACTION_VIEW, Uri.parse(url)), PendingIntent.FLAG_UPDATE_CURRENT).send(); } catch (PendingIntent.CanceledException e) { Log.e(UrlButtonReceiver.class.getSimpleName(), e.getMessage(), e); } } final NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(notificationId); }
From source file:com.axibase.tsd.plain.MessageInsertCommand.java
@Override protected void appendValues(StringBuilder sb) { //message e:<entity> s:<timestamp> t:<key-1>=<value-2> t:<key-2>=<value-2> m:<message> if (StringUtils.isNoneBlank(messageText)) { sb.append(" m:").append(normalize(messageText)); }/*from w w w. j a v a 2 s . c o m*/ }
From source file:cn.afterturn.easypoi.excel.html.css.impl.HeightCssConverImpl.java
@Override public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) { if (StringUtils.isNoneBlank(style.getHeight())) { int height = Math.round(PoiCssUtils.getInt(style.getHeight()) * 255 / 12.75F); Row row = cell.getRow();// ww w . j a v a 2 s .c o m if (height > row.getHeight()) { row.setHeight((short) height); } } }
From source file:cn.afterturn.easypoi.excel.html.css.impl.WidthCssConverImpl.java
@Override public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) { if (StringUtils.isNoneBlank(style.getWidth())) { int width = (int) Math.round(PoiCssUtils.getInt(style.getWidth()) * 2048 / 8.43F); Sheet sheet = cell.getSheet();//from www .jav a 2 s .c o m int colIndex = cell.getColumnIndex(); if (width > sheet.getColumnWidth(colIndex)) { if (width > 255 * 256) { width = 255 * 256; } sheet.setColumnWidth(colIndex, width); } } }
From source file:com.github.bjoern2.codegen.JavaFileImpl.java
@Override public void write(int tabs, Generator writer) { if (comment != null && !comment.isEmpty()) { String[] commentLines = comment.split("\\r?\\n"); writer.tab(tabs).write("/*").lineBreak(); for (String commentLine : commentLines) { writer.tab(tabs).write(" * ").write(commentLine).lineBreak(); }//from www .ja v a2s . c o m writer.tab(tabs).write(" */").lineBreak(); } if (StringUtils.isNoneBlank(_package)) { writer.tab(tabs).write("package " + _package + ";").lineBreak(); writer.lineBreak(); } if (imports != null) { for (JavaType type : imports) { writer.tab(tabs).write("import " + type.getName() + ";").lineBreak(); } writer.lineBreak(); } if (definition != null) { definition.write(tabs, writer); writer.lineBreak(); } }