List of usage examples for org.apache.commons.lang3 StringUtils trimToNull
public static String trimToNull(final String str)
Removes control characters (char <= 32) from both ends of this String returning null if the String is empty ("") after the trim or if it is null .
From source file:com.threewks.thundr.view.jsonp.JsonpViewResolver.java
public static String getCallback(HttpServletRequest req) { Object callback = req.getParameter("callback"); String callbackStr = callback == null ? null : StringUtils.trimToNull(callback.toString()); callbackStr = callbackStr == null ? "callback" : callbackStr; return callbackStr; }
From source file:ltistarter.lti.LTIConsumerDetailsService.java
@Override public ConsumerDetails loadConsumerByConsumerKey(String consumerKey) throws OAuthException { consumerKey = StringUtils.trimToNull(consumerKey); assert StringUtils.isNotEmpty(consumerKey) : "consumerKey must be set and not null"; BaseConsumerDetails cd;/*ww w . j a va 2 s . co m*/ LtiKeyEntity ltiKey = ltiKeyRepository.findByKeyKey(consumerKey); if (ltiKey == null) { // no matching key found throw new OAuthException("No matching lti key record was found for " + consumerKey); } else { cd = new BaseConsumerDetails(); cd.setConsumerKey(consumerKey); cd.setSignatureSecret(new SharedConsumerSecretImpl(ltiKey.getSecret())); cd.setConsumerName(String.valueOf(ltiKey.getKeyId())); cd.setRequiredToObtainAuthenticatedToken(false); // no token required (0-legged) cd.getAuthorities().add(new SimpleGrantedAuthority("ROLE_OAUTH")); // add the ROLE_OAUTH (can add others as well) cd.getAuthorities().add(new SimpleGrantedAuthority("ROLE_LTI")); log.info("LTI check SUCCESS, consumer key: " + consumerKey); } return cd; }
From source file:hoot.services.models.review.MarkItemsReviewedRequest.java
@Override public String toString() { String str = ""; if (StringUtils.trimToNull(reviewedItemsChangeset) != null) { str += "reviewedItemsChangeset:\n"; str += reviewedItemsChangeset;/* www . java2s. co m*/ str += "\n\n"; } if (reviewedItems != null && reviewedItems.getReviewedItems() != null) { str += "reviewedItems:\n"; for (ReviewedItem reviewedItem : reviewedItems.getReviewedItems()) { str += reviewedItem.toString() + "\n"; } } if (StringUtils.trimToNull(reviewedItemsChangeset) == null && (reviewedItems == null || reviewedItems.getReviewedItems() == null)) { return "empty object"; } return str; }
From source file:com.hubrick.vertx.s3.model.Grantee.java
public Grantee(String emailAddress) { checkNotNull(StringUtils.trimToNull(emailAddress), "emailAddress must not be null"); this.emailAddress = emailAddress; }
From source file:com.squarespace.template.plugins.platform.i18n.LegacyMoneyFormatter.java
private static String getLocaleArg(Arguments args) { if (args.count() == 0) { return null; }// w ww . j a v a 2 s . c o m return StringUtils.trimToNull(args.first()); }
From source file:ch.aonyx.broker.ib.api.execution.CommissionReport.java
public String getExecutionId() { return StringUtils.trimToNull(executionId); }
From source file:com.intuit.karate.cucumber.StepWrapper.java
public StepWrapper(ScenarioWrapper scenario, int index, String priorText, Step step, boolean background) { this.scenario = scenario; this.index = index; this.priorText = StringUtils.trimToNull(priorText); this.background = background; this.step = step; }
From source file:com.synopsys.integration.log.BufferedIntLogger.java
public String getOutputString(final LogLevel level) { return StringUtils.trimToNull(StringUtils.join(getOutputList(level), '\n')); }
From source file:com.xylocore.cassandra.query.TableScanQueryBuilder.java
/** * FILLIN/*from w w w . j a va2 s . c o m*/ * * @param aKeyspace * * @return */ public TableScanQueryBuilder<T> keyspace(String aKeyspace) { aKeyspace = StringUtils.trimToNull(aKeyspace); keyspace = aKeyspace; return this; }
From source file:com.squarespace.template.plugins.platform.i18n.LegacyMoneyFormatter.java
private static Currency getCurrency(JsonNode node) { String currencyStr = StringUtils.trimToNull(node.path(CURRENCY_FIELD_NAME).asText()); if (currencyStr == null) { return DEFAULT_CURRENCY; }//from ww w . j a v a2 s. c om return Currency.getInstance(currencyStr); }