Java Code Examples for org.apache.commons.lang3.StringUtils#stripToEmpty()

The following examples show how to use org.apache.commons.lang3.StringUtils#stripToEmpty() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: synopsys-detect   File: GitFileParser.java    License: Apache License 2.0 6 votes vote down vote up
public List<GitConfigNode> parseGitConfig(final List<String> gitConfigLines) {
    final List<GitConfigNode> gitConfigNodes = new ArrayList<>();
    final List<String> lineBuffer = new ArrayList<>();
    for (final String rawLine : gitConfigLines) {
        final String line = StringUtils.stripToEmpty(rawLine);

        if (StringUtils.isBlank(line)) {
            continue;
        }

        if (isGitConfigNodeStart(line)) {
            final Optional<GitConfigNode> gitConfigNode = processGitConfigNodeLines(lineBuffer);
            gitConfigNode.ifPresent(gitConfigNodes::add);
            lineBuffer.clear();
        }

        lineBuffer.add(line);
    }

    processGitConfigNodeLines(lineBuffer).ifPresent(gitConfigNodes::add);

    return gitConfigNodes;
}
 
Example 2
/**
 * Load the server and optional anycast server location information. Using format
 * {@code<server>_<location>}
 * 
 * @param name server name
 */
public void setServer(String name) {
  serverInfo = new ServerInfo();

  String cleanName = StringUtils.stripToEmpty(name);
  if (StringUtils.isBlank(cleanName)) {
    cleanName = DEFAULT_SERVER_NAME;
    serverInfo.setDefaultServer(true);
  }

  // name to use to scan for files
  serverInfo.setName(cleanName);
  // name to use for server
  serverInfo.setServer(cleanName);
  serverInfo.setNormalizedName(cleanName.replaceAll("[^A-Za-z0-9 ]", "_"));

  if (cleanName.length() > 0 && cleanName.contains("_")) {
    String[] parts = StringUtils.split(cleanName, "_");
    if (parts.length == 2) {
      // found anycast location in name, split into server and location part
      serverInfo.setServer(parts[0]);
      serverInfo.setLocation(parts[1]);
    }
  }
}
 
Example 3
public String usages(Request request, Response response) {
    final String elasticProfileId = StringUtils.stripToEmpty(request.params(PROFILE_ID_PARAM));
    final Collection<ElasticProfileUsage> jobsUsingElasticProfile = elasticProfileService.getUsageInformation(elasticProfileId);
    return ElasticProfileUsageRepresenter.toJSON(jobsUsingElasticProfile);
}
 
Example 4
Source Project: analysis-model   File: IssueBuilder.java    License: MIT License 2 votes vote down vote up
/**
 * Sets  an additional description for this issue. Static analysis tools might provide some additional information
 * about this issue. This description may contain valid HTML.
 *
 * @param description
 *         the description (as HTML content)
 *
 * @return this
 */
public IssueBuilder setDescription(@Nullable final String description) {
    this.description = StringUtils.stripToEmpty(description);
    return this;
}
 
Example 5
Source Project: analysis-model   File: Issue.java    License: MIT License 2 votes vote down vote up
/**
 * Sets the finger print for this issue to the given value.
 *
 * @param fingerprint
 *         the fingerprint to set
 *
 * @see #getFingerprint()
 */
void setFingerprint(@Nullable final String fingerprint) {
    this.fingerprint = StringUtils.stripToEmpty(fingerprint);
}