public ProjectDefinition setName(String s) { properties.put(CoreProperties.PROJECT_NAME_PROPERTY, StringUtils.defaultString(s)); return this; }
/** * Logs into the log file. Handles an extra detail which will not be printed if null. * BeeLine uses the operation log file to show the logs to the user, so depending on the * BeeLine settings it could be shown to the user. * @param info The log message * @param detail Extra detail to log which will be not printed if null */ public void logInfo(String info, String detail) { LOG.info(info + StringUtils.defaultString(detail)); }
public String validKey(String key) { requireNonNull(key, "key can't be null"); String trimmedKey = key.trim(); return StringUtils.defaultString(deprecatedKeys.get(trimmedKey), trimmedKey); }
@Override public File newFile(@Nullable String prefix, @Nullable String suffix) { try { return junit.newFile(StringUtils.defaultString(prefix) + "-" + StringUtils.defaultString(suffix)); } catch (IOException e) { throw new IllegalStateException("Fail to create temp file", e); } } }
public MinimumViableSystem checkRequiredJavaOptions(Map<String, String> requiredJavaOptions) { for (Map.Entry<String, String> entry : requiredJavaOptions.entrySet()) { String value = System.getProperty(entry.getKey()); if (!StringUtils.equals(value, entry.getValue())) { throw new MessageException(format( "JVM option '%s' must be set to '%s'. Got '%s'", entry.getKey(), entry.getValue(), StringUtils.defaultString(value))); } } return this; } }
/** * @deprecated to be dropped in 4.4. Default values are declared in ws metadata */ @CheckForNull @Deprecated public String param(String key, @CheckForNull String defaultValue) { return StringUtils.defaultString(param(key), defaultValue); }
/** * Gets a short message summarising the exception. * <p> * The message returned is of the form * {ClassNameWithoutPackage}: {ThrowableMessage} * * @param th the throwable to get a message for, null returns empty string * @return the message, non-null * @since Commons Lang 2.2 */ public static String getMessage(Throwable th) { if (th == null) { return ""; } String clsName = ClassUtils.getShortClassName(th, null); String msg = th.getMessage(); return clsName + ": " + StringUtils.defaultString(msg); }
@DataBoundConstructor public BuildTrigger(String childProjects, String threshold) { this(childProjects, Result.fromString(StringUtils.defaultString(threshold, Result.SUCCESS.toString()))); }
@CheckForNull public FilePath getRootPath() { final SlaveComputer computer = getComputer(); if (computer == null) { // if computer is null then channel is null and thus we were going to return null anyway return null; } else { return createPath(StringUtils.defaultString(computer.getAbsoluteRemoteFs(), remoteFS)); } }
LineHashKey(Trackable trackable) { this.ruleKey = trackable.getRuleKey(); this.lineHash = StringUtils.defaultString(trackable.getLineHash(), ""); }
@CheckForNull @Override public List<String> paramAsStrings(String key) { WebService.Param definition = action.param(key); String value = defaultString(readParam(key, definition), definition.defaultValue()); if (value == null) { return null; } List<String> values = COMMA_SPLITTER.splitToList(value); return validateValues(values, definition); }
@CheckForNull private String readParam(String key, @Nullable WebService.Param definition) { checkArgument(definition != null, "BUG - parameter '%s' is undefined for action '%s'", key, action.key()); String deprecatedKey = definition.deprecatedKey(); return deprecatedKey != null ? defaultString(readParam(deprecatedKey), readParam(key)) : readParam(key); }
@Override public Map<String, String> loadAll() { try (DbSession dbSession = dbClient.openSession(false)) { return dbClient.propertiesDao().selectGlobalProperties(dbSession) .stream() .collect(MoreCollectors.uniqueIndex(PropertyDto::getKey, p -> defaultString(p.getValue()))); } }
protected LineAndLineHashKey(Trackable trackable) { this.ruleKey = trackable.getRuleKey(); this.line = trackable.getLine(); this.lineHash = StringUtils.defaultString(trackable.getLineHash(), ""); }
LineHashAndMessageKey(Trackable trackable) { this.ruleKey = trackable.getRuleKey(); this.message = trackable.getMessage(); this.lineHash = StringUtils.defaultString(trackable.getLineHash(), ""); }
@Override public String load(String key) { PropertyDto dto = dbClient.propertiesDao().selectGlobalProperty(key); if (dto != null) { return defaultString(dto.getValue()); } return null; }
@Override public final boolean hasComponentPermission(String permission, ComponentDto component) { if (isRoot()) { return true; } String projectUuid = defaultString(component.getMainBranchProjectUuid(), component.projectUuid()); return hasProjectUuidPermission(permission, projectUuid); }
protected LineAndLineHashAndMessage(Trackable trackable) { this.ruleKey = trackable.getRuleKey(); this.line = trackable.getLine(); this.message = trackable.getMessage(); this.lineHash = StringUtils.defaultString(trackable.getLineHash(), ""); }
private void loadUserSession(HttpServletRequest request, HttpServletResponse response, boolean urlSupportsSystemPasscode) { UserSession session = requestAuthenticator.authenticate(request, response); if (!session.isLoggedIn() && !urlSupportsSystemPasscode && config.getBoolean(CORE_FORCE_AUTHENTICATION_PROPERTY).orElse(false)) { // authentication is required throw AuthenticationException.newBuilder() .setSource(Source.local(AuthenticationEvent.Method.BASIC)) .setMessage("User must be authenticated") .build(); } threadLocalSession.set(session); request.setAttribute(ACCESS_LOG_LOGIN, defaultString(session.getLogin(), "-")); }
private static void appendHeader(Notification notif, StringBuilder sb) { appendLine(sb, StringUtils.defaultString(notif.getFieldValue("componentName"), notif.getFieldValue("componentKey"))); String branchName = notif.getFieldValue(FIELD_BRANCH); if (branchName != null) { appendField(sb, "Branch", null, branchName); } String pullRequest = notif.getFieldValue(FIELD_PULL_REQUEST); if (pullRequest != null) { appendField(sb, "Pull request", null, pullRequest); } appendField(sb, "Rule", null, notif.getFieldValue("ruleName")); appendField(sb, "Message", null, notif.getFieldValue("message")); }