private static String chooseSocketChannel() { String socketChannel = System.getenv("canal.socketChannel"); if (StringUtils.isEmpty(socketChannel)) { socketChannel = System.getProperty("canal.socketChannel"); } if (StringUtils.isEmpty(socketChannel)) { socketChannel = "bio"; // bio or netty } return socketChannel; } }
public Boolean hasFilter() { if (filter == null) { return false; } return StringUtils.isNotBlank(filter); }
public boolean isLastFile(String fileName) { String needCompareName = lastDownload; if (StringUtils.isNotEmpty(needCompareName) && StringUtils.endsWith(needCompareName, "tar")) { needCompareName = needCompareName.substring(0, needCompareName.indexOf(".")); } return (needCompareName == null || fileName.equalsIgnoreCase(needCompareName)) && binlogList.isEmpty(); }
@Override public void checkName(String name) { if (StringUtils.isNotBlank(namePattern) && StringUtils.isNotBlank(name)) { if (!Pattern.matches(namePattern, name)) { throw new Failure(StringUtils.isEmpty(description) ? Messages.Hudson_JobNameConventionNotApplyed(name, namePattern) : description); } } }
public AviaterRegexFilter(String pattern, boolean defaultEmptyValue){ this.defaultEmptyValue = defaultEmptyValue; List<String> list = null; if (StringUtils.isEmpty(pattern)) { list = new ArrayList<String>(); } else { String[] ss = StringUtils.split(pattern, SPLIT); list = Arrays.asList(ss); } // 对pattern按照从长到短的排序 // 因为 foo|foot 匹配 foot 会出错,原因是 foot 匹配了 foo 之后,会返回 foo,但是 foo 的长度和 foot // 的长度不一样 Collections.sort(list, COMPARATOR); // 对pattern进行头尾完全匹配 list = completionPattern(list); this.pattern = StringUtils.join(list, PATTERN_SPLIT); }
public String getChoicesText() { return StringUtils.join(choices, "\n"); }
public void setUrl(String url) { if (StringUtils.isNotEmpty(url)) { this.url = url; } }
private static void addFile(Node root, ScannerReport.Component file) { Preconditions.checkArgument(!StringUtils.isEmpty(file.getProjectRelativePath()), "Files should have a project relative path: " + file); String[] split = StringUtils.split(file.getProjectRelativePath(), '/'); Node currentNode = root; for (int i = 0; i < split.length; i++) { currentNode = currentNode.children().computeIfAbsent(split[i], k -> new Node()); } currentNode.reportComponent = file; }
/** * 'utf8' COLLATE 'utf8_general_ci' * * @param charset * @return */ public static final String collateCharset(String charset) { String[] output = StringUtils.split(charset, "COLLATE"); return output[0].replace('\'', ' ').trim(); }
/** * {@inheritDoc} */ @Override public boolean equals(@Nonnull String id1, @Nonnull String id2) { return StringUtils.equals(id1, id2); }
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; } }
@Override public String toString() { return "Config[hostnames=" + StringUtils.join(hostnames, ',') + ", port=" + port + ", timeoutMS=" + timeoutMS + ", frameSize=" + frameSize + "]"; } }
private static String getLocalMavenRepositoryPath() { String userHome = System.getProperty("user.home"); if (StringUtils.isNotEmpty(userHome)) { return userHome + File.separator + ".m2" + File.separator + "repository"; } return null; }
/** * 判断当前的entry和position是否相同 */ public static boolean checkPosition(Event event, LogPosition logPosition) { EntryPosition position = logPosition.getPostion(); boolean result = position.getTimestamp().equals(event.getExecuteTime()); boolean exactely = (StringUtils.isBlank(position.getJournalName()) && position.getPosition() == null); if (!exactely) {// 精确匹配 result &= position.getPosition().equals(event.getPosition()); if (result) {// short path result &= StringUtils.equals(event.getJournalName(), position.getJournalName()); } } return result; } }
/** * {@inheritDoc} */ @Override public boolean equals(@Nonnull String id1, @Nonnull String id2) { return StringUtils.equals(keyFor(id1), keyFor(id2)); }
public int aggrConfigInfoCount(String dataId, String group, String tenant) { String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; String sql = " SELECT COUNT(ID) FROM config_info_aggr WHERE data_id = ? AND group_id = ? AND tenant_id = ?"; Integer result = jt.queryForObject(sql, Integer.class, new Object[] {dataId, group, tenantTmp}); if (result == null) { throw new IllegalArgumentException("aggrConfigInfoCount error"); } return result.intValue(); }
private void assertMandatoryParameterNotEmpty(String paramValue, String fieldName) { if (StringUtils.isEmpty(paramValue)) { throw new IllegalArgumentException(fieldName + " should be provided."); } }