List of usage examples for org.apache.commons.lang3 StringUtils trimToEmpty
public static String trimToEmpty(final String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null .
From source file:kenh.xscript.elements.Set.java
public void process(@Attribute(ATTRIBUTE_VARIABLE) String var, @Attribute(ATTRIBUTE_VALUE) Object value, @Attribute(ATTRIBUTE_DEFAULT) Object defaultValue) throws UnsupportedScriptException { var = StringUtils.trimToEmpty(var); if (StringUtils.isBlank(var)) { UnsupportedScriptException ex = new UnsupportedScriptException(this, "Variable name is empty."); throw ex; }/*from w w w .j av a2s. co m*/ this.invokeChildren(); Vector<Element> children = this.getChildren(); for (Element child : children) { if (child instanceof Condition) { Condition c = (Condition) child; if (c.getCondition()) value = c.getValue(); } } saveVariable(var, value, defaultValue); }
From source file:kenh.xscript.database.elements.Savepoint.java
public void process(@Attribute(ATTRIBUTE_VARIABLE) String var, @Attribute(ATTRIBUTE_REF) java.sql.Connection conn) throws UnsupportedScriptException { var = StringUtils.trimToEmpty(var); if (StringUtils.isBlank(var)) { UnsupportedScriptException ex = new UnsupportedScriptException(this, "Variable name is empty."); throw ex; }//ww w.j a v a2 s. c om java.sql.Savepoint sp = null; try { sp = conn.setSavepoint(); } catch (Exception e) { throw new UnsupportedScriptException(this, e); } this.saveVariable(var, sp, null); }
From source file:ke.co.tawi.babblesms.server.beans.contact.Phone.java
public void setContactUuid(String contactsuuid) { this.contactUuid = StringUtils.trimToEmpty(contactsuuid); }
From source file:ke.co.tawi.babblesms.server.beans.contact.Email.java
/** * @param contactuuid */ public void setContactuuid(String contactuuid) { this.contactUuid = StringUtils.trimToEmpty(contactuuid); }
From source file:eu.europa.ec.grow.espd.ted.TedService.java
public TedResponse getContractNoticeInformation(TedRequest tedRequest) { String receptionId = StringUtils.trimToEmpty(tedRequest.getReceptionId()); if (StringUtils.isBlank(receptionId)) { return new TedResponse(); }/*from w ww . j a v a2 s.c o m*/ log.info("--- Calling TED with reception id: '{}'.", receptionId); try { HttpEntity<String> request = new HttpEntity<>(createHeaders(tedUser, tedPassword)); ResponseEntity<TedResponse> response = restTemplate.exchange(tedUrl + "/" + receptionId, HttpMethod.GET, request, TedResponse.class); log.info("Got response from TED: '{}'.", response); return response.getBody(); } catch (Exception e) { log.warn(e.getMessage(), e); return new TedResponse(); } }
From source file:ke.co.tawi.babblesms.server.beans.account.Status.java
/** * * @param description */ public void setDescription(String description) { this.description = StringUtils.trimToEmpty(description); }
From source file:com.callidusrobotics.droptables.configuration.LoginInfo.java
@JsonProperty public void setPassword(String password) { this.password = StringUtils.trimToEmpty(password); }
From source file:kenh.xscript.elements.Print.java
public void process(@Attribute(ATTRIBUTE_VALUE) String value, @Attribute(ATTRIBUTE_TRIM) boolean trim) throws UnsupportedScriptException { print(StringUtils.trimToEmpty(value)); }
From source file:com.esri.geoportal.commons.robots.BotsReader.java
public BotsReader(String userAgent, MatchingStrategy matchingStrategy, WinningStrategy winningStrategy, InputStream inputStream) throws UnsupportedEncodingException { this.userAgent = StringUtils.trimToEmpty(userAgent); this.matchingStrategy = matchingStrategy; this.winningStrategy = winningStrategy; this.reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); }
From source file:com.threewks.thundr.servlet.ServletExceptionViewResolver.java
protected void sendError(Throwable exceptionOfInterest, HttpServletResponse rawResponse) { try {//from ww w . ja v a 2s .c o m String message = exceptionOfInterest == null ? "" : StringUtils.trimToEmpty(exceptionOfInterest.getMessage()); rawResponse.sendError(StatusCode.InternalServerError.getCode(), message); } catch (IOException e) { throw new ViewResolutionException(e, "Failed to send error to client: %s", e.getMessage()); } }