List of usage examples for org.apache.commons.lang StringUtils defaultString
public static String defaultString(String str)
Returns either the passed in String, or if the String is null
, an empty String ("").
From source file:info.magnolia.voting.voters.PropertyVoter.java
@Override protected boolean boolVote(Object value) { String propertyValue = StringUtils.defaultString(SystemProperty.getProperty(property)); return propertyValue.equals(this.value); }
From source file:com.joshlong.lazyblogger.service.BlogService.java
public void setBlogId(String blogId) { this.blogId = StringUtils.defaultString(blogId).trim(); }
From source file:com.fet.crm.smarthome.generic.util.RegularExpressionUtil.java
/** * DOCUMENT ME!/*from w w w . j a v a 2 s. co m*/ * * @param xmlString * DOCUMENT ME! * @param tagName * DOCUMENT ME! * * @return DOCUMENT ME! */ public static String[] getTagValueArray(final String xmlString, final String tagName) { final List<String> returnStr = new ArrayList<String>(); try { final Pattern pattern = getPattern(tagName); final Matcher matcher = pattern.matcher(xmlString); int count; while (matcher.find()) { count = matcher.groupCount(); returnStr.add(StringUtils.defaultString(matcher.group(count))); } } catch (Exception e) { LOG.info("Exception occurs in RegularExpressionUtil.getTagValue", e); } return returnStr.toArray(new String[returnStr.size()]); }
From source file:com.redhat.rhn.frontend.xmlrpc.serializer.PackageOverviewSerializer.java
/** {@inheritDoc} */ protected void doSerialize(Object value, Writer output, XmlRpcSerializer serializer) throws XmlRpcException, IOException { PackageOverview pO = (PackageOverview) value; SerializerHelper helper = new SerializerHelper(serializer); helper.add("id", pO.getId()); helper.add("name", pO.getPackageName()); helper.add("summary", pO.getSummary()); helper.add("description", StringUtils.defaultString(pO.getDescription())); helper.add("version", pO.getVersion()); helper.add("release", pO.getRelease()); String epoch = pO.getEpoch(); if (epoch == null) { epoch = ""; }/*from www . j av a 2 s . c om*/ helper.add("epoch", epoch); helper.add("arch", pO.getPackageArch()); helper.add("nvre", pO.getPackageNvre()); helper.add("nvrea", pO.getNvrea()); helper.add("packageChannels", pO.getPackageChannels()); helper.add("provider", pO.getProvider()); helper.writeTo(output); }
From source file:de.snertlab.xdccBee.irc.IrcChannel.java
public Element makeXmlNode() { Element nodeChannel = new Element("IRC_CHANNEL"); //$NON-NLS-1$ nodeChannel.setAttribute("channelName", StringUtils.defaultString(channelName)); //$NON-NLS-1$ return nodeChannel; }
From source file:com.smartitengineering.cms.api.impl.content.FieldValueImpl.java
@Override public final String toString() { return StringUtils.defaultString(getValueAsString()); }
From source file:de.thischwa.pmcms.gui.dialog.pojo.DialogFieldsLevelComp.java
private void initialize() { String filename = StringUtils.defaultString(level.getName()); GridData gridDataLabel = new GridData(); gridDataLabel.widthHint = 100;//from w w w .j a va2s . c om gridDataLabel.verticalAlignment = GridData.CENTER; gridDataLabel.horizontalAlignment = GridData.END; GridData gridDataText = new GridData(); gridDataText.heightHint = -1; gridDataText.widthHint = 150; GridLayout gridLayoutMy = new GridLayout(); gridLayoutMy.numColumns = 2; gridLayoutMy.marginWidth = 25; gridLayoutMy.verticalSpacing = 5; gridLayoutMy.horizontalSpacing = 20; gridLayoutMy.marginHeight = 25; gridLayoutMy.makeColumnsEqualWidth = false; GridData gridDataMy = new GridData(); gridDataMy.grabExcessHorizontalSpace = true; gridDataMy.verticalAlignment = GridData.CENTER; gridDataMy.horizontalSpan = 1; gridDataMy.horizontalAlignment = GridData.FILL; this.setLayoutData(gridDataMy); this.setLayout(gridLayoutMy); Label labelTitle = new Label(this, SWT.RIGHT); labelTitle.setText("* ".concat(LabelHolder.get("dialog.pojo.level.fields.title"))); //$NON-NLS-1$ labelTitle.setLayoutData(gridDataLabel); textTitle = new Text(this, SWT.BORDER); textTitle.setTextLimit(256); textTitle.setLayoutData(gridDataText); textTitle.setText(StringUtils.defaultString(level.getTitle())); Label labelName = new Label(this, SWT.RIGHT); labelName.setText("* ".concat(LabelHolder.get("dialog.pojo.level.fields.name"))); //$NON-NLS-1$ labelName.setLayoutData(gridDataLabel); textName = new Text(this, SWT.BORDER); textName.setTextLimit(256); textName.setLayoutData(gridDataText); textName.setText(filename); textName.addVerifyListener(new FileNameVerifier()); textName.addModifyListener(new ModifyListenerClearErrorMessages(dialogCreator)); Collection<String> forbiddenNames = new ArrayList<String>(); Collection<Level> sisters = level.getParent().getSublevels(); if (CollectionUtils.isNotEmpty(sisters)) for (Level otherLevel : sisters) forbiddenNames.add(otherLevel.getName()); if (StringUtils.isNotBlank(filename)) forbiddenNames.remove(filename); if (level.getId() == APoormansObject.UNSET_VALUE) // suggestion of the file name should work just with new objects textTitle.addModifyListener(new FilenameSuggestorListener(dialogCreator, textName, forbiddenNames)); }
From source file:AIR.Common.Web.Session.HttpRequestLoggerInitializerFilter.java
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; final String requestPath = StringUtils.defaultString(httpRequest.getRequestURI()); MDC.put("requestSequence", getNextSequence()); MDC.put("requestTime", new SimpleDateFormat("YYYY-MM-dd hh:mm:ss.SSS").format(new Date())); MDC.put("requestPath", requestPath); MDC.put("safeRequestPath", requestPath.replace('/', '~').replace('\\', '~')); MDC.put("prefix", StringUtils.defaultString(prefix, "")); HttpServletRequest wrappedRequest = httpRequest; if (logger.isDebugEnabled()) { addRequestDetailsToLoggers(httpRequest); // TODO: To log request bodies, more work is needed on the ContentLoggingHttpServletRequest // if (logRequestBodies && !( // httpRequest.getMethod ().equals ("GET") || // httpRequest.getMethod ().equals ("DELETE"))) { // wrappedRequest = new ContentLoggingHttpServletRequest (httpRequest); // ((ContentLoggingHttpServletRequest) wrappedRequest).logContent (logger); // } // else { // logger.debug ("<<<<< Request content logging disabled. Set filter parameter LogRequestBodies to enable >>>>>"); // } }/*from w ww.ja v a 2 s . c om*/ chain.doFilter(wrappedRequest, response); // This tells the appender to close the file with the next logging request MDC.put("close", "true"); logger.debug("========================== Request Logging End ==================================="); MDC.clear(); }
From source file:com.apress.prospringintegration.batch.UserRegistrationValidationItemProcessor.java
private boolean isValidState(String state) { return states.contains(StringUtils.defaultString(state).trim()); }
From source file:com.stumbleupon.hbaseadmin.JMXQuery.java
public JMXQuery(String mbean, String jmx_command, String password_file) { this.beanName = StringUtils.defaultString(mbean); this.command = StringUtils.defaultString(jmx_command); this.password_file = StringUtils.defaultString(password_file); }