List of usage examples for org.apache.commons.lang ArrayUtils isEmpty
public static boolean isEmpty(boolean[] array)
Checks if an array of primitive booleans is empty or null
.
From source file:com.taobao.datasource.DataSourceConfigFinder.java
@Override protected File[] findConfigFiles(File currentPath) { FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith("-ds.xml"); }/*w ww.j a v a 2 s . c om*/ }; File[] files = currentPath.listFiles(filter); // try conf/*-ds.xml if (ArrayUtils.isEmpty(files)) { File configDir = new File(currentPath, "conf"); if (configDir.isDirectory()) { files = configDir.listFiles(filter); } } return files; }
From source file:com.thoughtworks.go.legacywrapper.CCProjectFolderFilter.java
public boolean accept(File dirFile) { if (dirFile.isDirectory()) { String[] files = dirFile.list(new CCLogFilter()); return !ArrayUtils.isEmpty(files); }//from www. ja va 2 s .co m return false; }
From source file:com.taobao.itest.matcher.AssertExcludedPropertiesEquals.java
/** * assertPropertiesEqualsIgnoreOthers /*from www . ja v a2 s. c o m*/ * Mainly used to compare the two bean, * in addition to ignoring the property, other various attributes are equal * * * @param expect * @param actual * @param ignoredProperties ignoring property, * * */ public static void assertPropertiesEqualsIgnoreOthers(Object expect, Object actual, String... ignoredProperties) { if (!ArrayUtils.isEmpty(ignoredProperties)) { PropertyDescriptor[] props = BeanUtilsBean.getInstance().getPropertyUtils() .getPropertyDescriptors(expect); String propertyNames = ""; for (int i = 0; i < props.length; i++) { /* * The current bean in the property not for the "class", * nor is ignoredProperties values, this time to put in the comparison */ if (!props[i].getName().equals("class") && !ArrayUtils.contains(ignoredProperties, props[i].getName())) { propertyNames += props[i].getName() + ","; } } /* According to include comparison */ AssertPropertiesEquals.assertPropertiesEquals(expect, actual, propertyNames.substring(0, propertyNames.length() - 1).split(",")); } else { /* * This parameter is empty, the situation has in the upper control, * directly through the reflection verified. * But to prevent each other's direct calls, and still retain */ AssertPropertiesEquals.assertPropertiesEquals(expect, actual); } }
From source file:bigbluej.DocumentCommand.java
private DocumentCommand(String url, String name, byte[] content) { if (StringUtils.isNotBlank(url)) { Validate.isTrue(ArrayUtils.isEmpty(content), "when set url, don't set content too!"); Validate.isTrue(StringUtils.isBlank(name), "when set url, don't set name too!"); } else if (StringUtils.isNotBlank(name)) { Validate.isTrue(ArrayUtils.isNotEmpty(content), "when set name, set content too!"); Validate.isTrue(StringUtils.isBlank(url), "when set name, don't set url too!"); } else {/*ww w . ja v a2 s. c om*/ throw new IllegalArgumentException("set either name or url!"); } this.url = url; this.name = name; this.content = content; }
From source file:fr.exanpe.t5.lib.services.impl.AuthorizeBusinessServiceImpl.java
public boolean applyAny(String[] any) { if (ArrayUtils.isEmpty(any)) { return true; }//from w ww . ja v a2 s . c o m String[] roles = any; for (String r : roles) { if (r != null && request.getHTTPServletRequest().isUserInRole(r.trim())) { return true; } } return false; }
From source file:com.ning.jetty.core.listeners.SetupJULBridge.java
@Override public void contextInitialized(final ServletContextEvent event) { // We first remove the default handler(s) final Logger rootLogger = LogManager.getLogManager().getLogger(""); final Handler[] handlers = rootLogger.getHandlers(); if (!ArrayUtils.isEmpty(handlers)) { for (final Handler handler : handlers) { rootLogger.removeHandler(handler); }//w w w. ja v a 2 s .co m } // And then we let jul-to-sfl4j do its magic so that jersey messages go to sfl4j SLF4JBridgeHandler.install(); }
From source file:net.jforum.plugins.tagging.TagAdminActions.java
public void delete(@Parameter(key = "tags") String... tags) { if (!ArrayUtils.isEmpty(tags)) { for (String tag : tags) { if (tag != null) { this.repository.remove(tag); }// w w w . ja v a 2 s .c om } } this.viewService.redirectToAction(Actions.LIST); }
From source file:hudson.plugins.plot.PropertiesSeries.java
/** * Load the series from a properties file. *//*w w w .ja v a 2 s. c o m*/ @Override public List<PlotPoint> loadSeries(FilePath workspaceRootDir, int buildNumber, PrintStream logger) { InputStream in = null; FilePath[] seriesFiles = null; try { seriesFiles = workspaceRootDir.list(getFile()); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception trying to retrieve series files", e); return null; } if (ArrayUtils.isEmpty(seriesFiles)) { logger.println("No plot data file found: " + getFile()); return null; } try { in = seriesFiles[0].read(); logger.println("Saving plot series data from: " + seriesFiles[0]); Properties properties = new Properties(); properties.load(in); String yvalue = properties.getProperty("YVALUE"); String url = properties.getProperty("URL", ""); if (yvalue == null || url == null) { logger.println("Not creating point with null values: y=" + yvalue + " label=" + getLabel() + " url=" + url); return null; } List<PlotPoint> series = new ArrayList<PlotPoint>(); series.add(new PlotPoint(yvalue, url, getLabel())); return series; } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception reading plot series data from " + seriesFiles[0], e); return null; } finally { IOUtils.closeQuietly(in); } }
From source file:ch.nydi.aop.interceptor.TraceInterceptor.java
@Override public Object invoke(MethodInvocation invocation) throws Throwable { final String prefix = "invocation arguments of " + invocation.getMethod().getName() + " "; final Object[] arguments = invocation.getArguments(); if (ArrayUtils.isEmpty(arguments)) { this.logger.trace(prefix + "{no arguments}"); } else {/*from ww w.java 2 s . c o m*/ final StringBuilder flattenArguments = new StringBuilder(); flattenArguments.append("{"); for (int i = 0; i < arguments.length; i++) { if (i > 0) { flattenArguments.append(" | "); } flattenArguments.append(TraceInterceptor.this.flattenArgument(arguments[i])); } flattenArguments.append("}"); this.logger.trace(prefix + flattenArguments.toString()); } Object invocationResult = null; try { invocationResult = invocation.proceed(); } catch (final Throwable e) { this.logger.trace("execption occured, no return value"); throw e; } finally { final StringBuilder builder = new StringBuilder(); builder.append("invocation return value of ").append(invocation.getMethod().getName()).append(": {") .append(this.flattenArgument(invocationResult)).append("}"); this.logger.trace(builder.toString()); } return invocationResult; }
From source file:com.ning.metrics.action.binder.filters.SetupJULBridge.java
@Override public void contextInitialized(final ServletContextEvent event) { // we first remove the default handler(s) final Logger rootLogger = LogManager.getLogManager().getLogger(""); final Handler[] handlers = rootLogger.getHandlers(); if (!ArrayUtils.isEmpty(handlers)) { for (Handler handler : handlers) { rootLogger.removeHandler(handler); }//from ww w. j av a 2s.c o m } // and then we let jul-to-sfl4j do its magic so that jersey messages go to sfl4j (and thus log4j) SLF4JBridgeHandler.install(); log.info("Assimilated java.util Logging"); }