List of usage examples for org.apache.commons.lang StringUtils defaultString
public static String defaultString(String str, String defaultStr)
Returns either the passed in String, or if the String is null
, the value of defaultStr
.
From source file:info.magnolia.cms.security.SecuritySupportBase.java
protected static LoginContext createLoginContext(CredentialsCallbackHandler callbackHandler, String customLoginModule) throws LoginException { final String loginContextName = StringUtils.defaultString(customLoginModule, DEFAULT_JAAS_LOGIN_CHAIN); return new LoginContext(loginContextName, callbackHandler); }
From source file:com.sonar.it.jenkins.orchestrator.JenkinsOrchestratorBuilder.java
public String getOrchestratorProperty(String key) { return StringUtils.defaultString(overriddenProperties.get(key), config.getString(key)); }
From source file:com.canoo.webtest.plugins.pdftest.PdfVerifyLinkStep.java
protected void verifyPdf(final PDFPage pdfPage) { final IStringVerifier verifier = getVerifier(getRegex()); final String expectedValue = StringUtils.defaultString(getText(), getHref()); final List links = pdfPage.getLinks(); for (final Iterator iter = links.iterator(); iter.hasNext();) { final PDFLink element = (PDFLink) iter.next(); if (verifyLink(element, verifier, expectedValue)) return; }/*from ww w . ja v a2 s . c o m*/ throw new StepFailedException("No link found matching criteria."); }
From source file:com.bstek.dorado.view.type.property.MappingPropertyOutputter.java
@SuppressWarnings("rawtypes") protected void outputCollection(Mapping mapping, Collection mapValues, OutputContext context) throws Exception { String keyProperty = StringUtils.defaultString(mapping.getKeyProperty(), "key"); String valueProperty = StringUtils.defaultString(mapping.getValueProperty(), "value"); JsonBuilder json = context.getJsonBuilder(); json.array();//from w ww . ja v a2s . co m for (Object element : mapValues) { EntityWrapper entity = EntityWrapper.create(element); json.object(); json.key("key"); outputData(entity.get(keyProperty), context); json.endKey(); json.key("value"); outputData(entity.get(valueProperty), context); json.endKey(); json.endObject(); } json.endArray(); }
From source file:it.serverSystem.HttpsTest.java
@Before public void setUp() throws Exception { // SSLv3 is not supported since SQ 4.5.2. Only TLS v1, v1.1 and v1.2 are // enabled by Tomcat. // The problem is that java 1.6 supports only TLSv1 but not v1.1 nor 1.2, // so version to be used must be explicitly set on JVM. initialHttpsProtocols = StringUtils.defaultString(System.getProperty(HTTPS_PROTOCOLS), ""); System.setProperty(HTTPS_PROTOCOLS, "TLSv1"); }
From source file:com.atlassian.plugins.studio.storage.examples.ex1action.PropertySetConfigurableActionExample.java
private void loadConfig(StorageFacade storage) { setAdminOnly(storage.getBoolean(ADMIN_ONLY)); setHelloText(StringUtils.defaultString(storage.getString(HELLO_TEXT), "Hello, ")); setWelcomeText(StringUtils.defaultString(storage.getString(WELCOME_TEXT), "World")); }
From source file:com.flexive.shared.cache.impl.FxJBossEmbeddedCacheProvider.java
/** * {@inheritDoc}/*from w w w .j av a 2 s . com*/ */ @Override public void init() throws FxCacheException { if (cache != null) return; try { final Cache<Object, Object> tc = new DefaultCacheFactory<Object, Object>() .createCache(StringUtils.defaultString(System.getProperty(SYSTEM_CACHE_CONFIG), CONFIG_FILE)); tc.create(); tc.start(); cache = new FxJBossTreeCacheWrapper(tc); } catch (Exception e) { LOG.error("Failed to start TreeCache. Error: " + e.getMessage(), e); throw new FxCacheException(e); } }
From source file:com.axelor.apps.base.service.administration.SequenceService.java
public static boolean isValid(Sequence sequence) { boolean monthlyResetOk = sequence.getMonthlyResetOk(), yearlyResetOk = sequence.getYearlyResetOk(); if (!monthlyResetOk && !yearlyResetOk) { return true; }/*w w w.j a v a 2 s . c o m*/ String seqPrefixe = StringUtils.defaultString(sequence.getPrefixe(), ""), seqSuffixe = StringUtils.defaultString(sequence.getSuffixe(), ""), seq = seqPrefixe + seqSuffixe; if (yearlyResetOk && !seq.contains(PATTERN_YEAR)) { return false; } if (monthlyResetOk && !seq.contains(PATTERN_MONTH) && !seq.contains(PATTERN_FULL_MONTH) && !seq.contains(PATTERN_YEAR)) { return false; } return true; }
From source file:com.doculibre.constellio.solr.handler.component.SearchLogComponent.java
@Override @SuppressWarnings("unchecked") public void init(NamedList args) { LOG.info("Initializing searchLogComponent"); super.init(args); searchLogCoreName = StringUtils.defaultString((String) args.get("coreName"), "search_log"); commitThreshold = (int) args.get("commitThreshold"); searchLogCache = new ArrayList<SolrInputDocument>(); localPort = 0;//w w w. j a va 2s.co m searchLogServer = null; }
From source file:com.bstek.dorado.config.text.DispatchableTextParser.java
/** * ????//w w w . j a v a 2 s. c o m * @param constraint ?????null{@link #WILDCARD} * ?? * @param parser ? */ public void registerAttributeParser(String constraint, TextParser parser) { Assert.notNull(parser, "[parser] is required"); constraint = StringUtils.defaultString(constraint, WILDCARD); attributeParsers.put(constraint, parser); }