Tabnine Logo
StringUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
StringUtil
in
jetbrains.buildServer.util

Best Java code snippets using jetbrains.buildServer.util.StringUtil (Showing top 20 results out of 315)

origin: JetBrains/teamcity-s3-artifact-storage-plugin

public static String normalizeArtifactPath(final String path, final File file) {
 if (StringUtil.isEmpty(path)) {
  return file.getName();
 } else {
  return FileUtil.normalizeRelativePath(String.format("%s/%s", path, file.getName()));
 }
}
origin: PeteGoo/tcSlackBuildNotifier

  public boolean hasSlackUserId(){
    return StringUtil.isNotEmpty(slackUserId);
  }
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

@NotNull
public static Map<String, String> validateParameters(@NotNull Map<String, String> params, boolean acceptReferences) {
 final Map<String, String> invalids = new HashMap<String, String>();
 if (StringUtil.isEmptyOrSpaces(getBucketName(params))) {
  invalids.put(S3_BUCKET_NAME, "S3 bucket name must not be empty");
 }
 invalids.putAll(AWSCommonParams.validate(params, acceptReferences));
 return invalids;
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

public static String getContentType(File file) {
 String contentType = URLConnection.guessContentTypeFromName(file.getName());
 if (StringUtil.isNotEmpty(contentType)) {
  return contentType;
 }
 if (PROBE_CONTENT_TYPE_METHOD != null && FILE_TO_PATH_METHOD != null) {
  try {
   Object result = PROBE_CONTENT_TYPE_METHOD.invoke(null, FILE_TO_PATH_METHOD.invoke(file));
   if (result instanceof String) {
    contentType = (String)result;
   }
  } catch (Exception ignored) {
  }
 }
 return StringUtil.notEmpty(contentType, DEFAULT_CONTENT_TYPE);
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

@NotNull
private String getPathPrefix(@NotNull AgentRunningBuild build) {
 final List<String> pathSegments = new ArrayList<String>();
 pathSegments.add(build.getSharedConfigParameters().get(ServerProvidedProperties.TEAMCITY_PROJECT_ID_PARAM));
 pathSegments.add(build.getBuildTypeExternalId());
 pathSegments.add(Long.toString(build.getBuildId()));
 return StringUtil.join("/", pathSegments) + "/";
}
origin: tcplugins/tcWebHooks

public static boolean isCommonExternalError(@Nullable Throwable e) {
 if (e == null) return false;
 final String message = jetbrains.buildServer.util.StringUtil.emptyIfNull(e.getMessage());
 if (e.getClass().getName().endsWith(".IllegalStateException") && message.equals("Cannot call sendError() after the response has been committed")){
  //Jersey 1.19 (as opposed to Jersey 1.16) reports this error in case of ClientAbortException
  return true;
 }
 if (e.getClass().getName().endsWith(".IllegalStateException") && message.equals("getOutputStream() has already been called for this response")){
  //this is thrown on attempt to report error in already written response in APIController.reportRestErrorResponse()
  return true;
 }
 while (true) {
  if (e.getClass().getName().endsWith(".ClientAbortException")) return true;
  final Throwable cause = e.getCause();
  if (cause == null || cause == e) break;
  e = cause;
 }
 return false;
}
origin: tcplugins/tcWebHooks

public String getParameterAsStringOrNull(HttpServletRequest request, String paramName, String errorMessage) throws MissingPathException {
  String returnValue = StringUtil.nullIfEmpty(request.getParameter(paramName));
  if (returnValue == null || "".equals(returnValue.trim())) {
    throw new MissingPathException(errorMessage);
  }
  return returnValue;
}

origin: PeteGoo/tcSlackBuildNotifier

attachment.addField(this.payload.getBuildName(), StringUtil.join(firstDetailLines, "\n"), false);
    attachment.addField("Reason", StringUtil.join(", ", payload.getFailedBuildMessages()), false);
    attachment.addField("Failed Tests", StringUtil.join(", ", failedTestNames) + truncated, false);
  String committersString = StringUtil.join(", ", committers);
    mentionContent += StringUtil.join(" ", slackUsers);
origin: JetBrains/teamcity-s3-artifact-storage-plugin

@NotNull
private String getPatternsForBuild(@NotNull final BuildCleanupContext cleanupContext, @NotNull final SBuild build) {
 if (cleanupContext.getCleanupLevel().isCleanHistoryEntry()) return StringUtil.EMPTY;
 final CleanupPolicy policy = cleanupContext.getCleanupPolicyForBuild(build.getBuildId());
 return StringUtil.emptyIfNull(policy.getParameters().get(HistoryRetentionPolicy.ARTIFACT_PATTERNS_PARAM));
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

 @NotNull
 public static String writeS3ObjectKeys(@NotNull Collection<String> s3ObjectKeys) throws IOException {
  Element rootElement = new Element(S3_OBJECT_KEYS);
  for (String s3ObjectKey : s3ObjectKeys){
   if(StringUtil.isEmpty(s3ObjectKey)) continue;
   Element xmlElement = new Element(S3_OBJECT_KEY);
   xmlElement.addContent(s3ObjectKey);
   rootElement.addContent(xmlElement);
  }
  return JDOMUtil.writeDocument(new Document(rootElement), System.getProperty("line.separator"));
 }
}
origin: PeteGoo/tcSlackBuildNotifier

private boolean userHasSlackIdConfigured(SUser sUser) {
  String userName = sUser.getPropertyValue(USERID_KEY);
  return StringUtil.isNotEmpty(userName);
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

public PathPatternFilter(@NotNull String patterns) {
 if (StringUtil.isEmptyOrSpaces(patterns)) {
  patterns = "+:" + DEFAULT_INCLUDE_RULE;
 }
 final IncludeExcludeRules rules = new IncludeExcludeRules(patterns);
 for (IncludeExcludeRules.Rule r : rules.getRules()) {
  if (r.isInclude()) {
   myIncludePatterns.add(r.getRule());
  } else {
   myExcludePatterns.add(r.getRule());
  }
 }
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

final Map<String, String> settings = build.getArtifactStorageSettings();
final String bucketName = S3Util.getBucketName(settings);
if (StringUtil.isEmpty(bucketName)) {
 throw new IllegalArgumentException("S3 bucket name must not be empty");
origin: JetBrains/teamcity-s3-artifact-storage-plugin

final AWSException awsException = new AWSException(t);
final String details = awsException.getDetails();
if (StringUtil.isNotEmpty(details)) {
 final String message = awsException.getMessage() + details;
 LOG.warn(message);
origin: andreizhuk/tc-ansible-runner

 public Collection<InvalidProperty> process(final Map<String, String> properties) {
   List<InvalidProperty> errors = new ArrayList<InvalidProperty>();
   AnsibleRunConfig config = new AnsibleRunConfig(properties);
   if (AnsibleCommand.EXECUTABLE.equals(config.getCommandType())) {
     if (StringUtil.isEmptyOrSpaces(config.getExecutable())) {
       errors.add(new InvalidProperty(AnsibleRunnerConstants.EXECUTABLE_KEY, "Cannot be empty"));
     }
     if (StringUtil.isEmptyOrSpaces(config.getPlaybook())) {
       errors.add(new InvalidProperty(AnsibleRunnerConstants.PLAYBOOK_FILE_KEY, "Cannot be empty"));
     }
   } else if (AnsibleCommand.CUSTOM_SCRIPT.equals(config.getCommandType())) {
     if (StringUtil.isEmptyOrSpaces(config.getSourceCode())) {
       errors.add(new InvalidProperty(AnsibleRunnerConstants.SOURCE_CODE_KEY, "Cannot be empty"));
     }
   }
  return errors;
 }
};
origin: tcplugins/tcWebHooks

public ProjectWebhook findWebHookById(String projectExternalId, String webHookLocator, final @NotNull Fields fields, @NotNull final BeanContext beanContext) {
  if (StringUtil.isEmpty(webHookLocator)) {
    throw new BadRequestException("Empty webhook locator is not supported.");
  }
  final Locator locator = new Locator(webHookLocator, "id",
      Locator.LOCATOR_SINGLE_VALUE_UNUSED_NAME);
  if (locator.isSingleValue()) {
    // no dimensions found, assume it's a name or internal id or
    // external id
    @NotNull final String singleValue = locator.getSingleValue();		
    return getWebHookConfigById(projectExternalId, fields, beanContext, singleValue);
  } else if (locator.getSingleDimensionValue("id") != null){
    @NotNull final String webHookId = locator.getSingleDimensionValue("id");			
    return getWebHookConfigById(projectExternalId, fields, beanContext, webHookId);
  }
  
  throw new BadRequestException("Sorry: Searching for multiple template is not supported.");		
}
origin: JetBrains/teamcity-s3-artifact-storage-plugin

final String details = awsException.getDetails();
if (StringUtil.isNotEmpty(details)) {
 final String message = awsException.getMessage() + details;
 LOG.warn(message);
origin: tcplugins/tcWebHooks

public WebHookTemplateItemConfigWrapper findTemplateByIdAndTemplateContentById(String templateLocator, String templateContentLocator) {
  
  WebHookTemplateConfigWrapper templateConfigWrapper =  findTemplateById(templateLocator);
  
  if (StringUtil.isEmpty(templateLocator)) {
    throw new BadRequestException("Empty template locator is not supported.");
  }
  final Locator locator = new Locator(templateContentLocator, "id", "name",
      Locator.LOCATOR_SINGLE_VALUE_UNUSED_NAME);
  if (locator.isSingleValue()) {
    // no dimensions found, assume it's a name or id without "id:"
    @NotNull
    final String templateId = locator.getSingleValue();
    return buildWebHookTemplateItemConfigWrapper(templateConfigWrapper, templateId);
  } else if (locator.getSingleDimensionValue("id") != null){
    @NotNull
    final String templateId = locator.getSingleDimensionValue("id");
    return buildWebHookTemplateItemConfigWrapper(templateConfigWrapper, templateId);
  } else {
    throw new BadRequestException("Sorry: Searching for multiple templates is not supported.");
  }
  
}
origin: tcplugins/tcWebHooks

public WebHookTemplateConfigWrapper findTemplateById(String templateLocator) {
  if (StringUtil.isEmpty(templateLocator)) {
    throw new BadRequestException("Empty template locator is not supported.");
origin: PeteGoo/tcSlackBuildNotifier

public void getFromConfig(SlackNotification slackNotification, SlackNotificationConfig slackNotificationConfig){
  slackNotification.setChannel(StringUtil.isEmpty(slackNotificationConfig.getChannel()) ? myMainSettings.getDefaultChannel() : slackNotificationConfig.getChannel());
  slackNotification.setTeamName(myMainSettings.getTeamName());
  slackNotification.setToken(StringUtil.isEmpty(slackNotificationConfig.getToken()) ? myMainSettings.getToken() : slackNotificationConfig.getToken());
  slackNotification.setIconUrl(myMainSettings.getIconUrl());
  slackNotification.setBotName(myMainSettings.getBotName());
jetbrains.buildServer.utilStringUtil

Most used methods

  • isEmpty
  • isNotEmpty
  • isEmptyOrSpaces
  • emptyIfNull
  • join
  • notEmpty
  • nullIfEmpty
  • pluralize

Popular in Java

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • getExternalFilesDir (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now