private static String toCaseSensitive(String caseInsensitiveCollation) { // Example: big5_chinese_ci becomes big5_bin // Full list of collations is available with SQL request "show collation" return StringUtils.substringBefore(caseInsensitiveCollation, "_") + "_bin"; } }
private void insertSnapshot(Path snapshotPath) throws Exception { String datasetPath = StringUtils.substringBeforeLast(snapshotPath.toString(), Path.SEPARATOR); String snapshotName = StringUtils.substringAfterLast(snapshotPath.toString(), Path.SEPARATOR); long ts = Long.parseLong(StringUtils.substringBefore(snapshotName, "-PT-")); long recordCount = Long.parseLong(StringUtils.substringAfter(snapshotName, "-PT-")); PreparedStatement insert = connection.prepareStatement("INSERT INTO Snapshots VALUES (?, ?, ?, ?, ?)"); insert.setString(1, datasetPath); insert.setString(2, snapshotName); insert.setString(3, snapshotPath.toString()); insert.setTimestamp(4, new Timestamp(ts)); insert.setLong(5, recordCount); insert.executeUpdate(); }
/** * Convert strings "-Dkey=value" to properties */ static Properties argumentsToProperties(String[] args) { Properties props = new Properties(); for (String arg : args) { if (!arg.startsWith("-D") || !arg.contains("=")) { throw new IllegalArgumentException(String.format( "Command-line argument must start with -D, for example -Dsonar.jdbc.username=sonar. Got: %s", arg)); } String key = StringUtils.substringBefore(arg, "=").substring(2); String value = StringUtils.substringAfter(arg, "="); props.setProperty(key, value); } return props; } }
public static URLProtocol parseProtocol(String input) { return URLProtocol.fromString(StringUtils.substringBefore(input, ":")); }
private static String getPluginKey(HttpServletRequest request) { return StringUtils.substringBefore(getPluginKeyAndResourcePath(request), "/"); }
private void processMeasure(InputComponent component, SensorContext context, File measureFile, int lineNumber, String line) { try { String metricKey = StringUtils.substringBefore(line, ":"); String value = line.substring(metricKey.length() + 1); saveMeasure(context, component, metricKey, value); } catch (Exception e) { LOG.error("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e); throw new IllegalStateException("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e); } }
private void processMeasure(FileLinesContext context, File measureFile, int lineNumber, String line) { try { String metricKey = StringUtils.substringBefore(line, ":"); String value = line.substring(metricKey.length() + 1); saveMeasure(context, metricKey, KeyValueFormat.parseIntInt(value)); } catch (Exception e) { LOG.error("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e); throw new IllegalStateException("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e); } }
public String sanitize(String jdbcUrl) { String result; if (jdbcUrl.startsWith(SQLSERVER_PREFIX)) { result = sanitizeSqlServerUrl(jdbcUrl); } else { // remove query parameters, they don't aim to reference the schema result = StringUtils.substringBefore(jdbcUrl, "?"); } return StringUtils.lowerCase(result, Locale.ENGLISH); }
private void ensureNotLoopbackAddresses(Props props, String propertyKey) { stream(requireValue(props, propertyKey).split(",")) .filter(StringUtils::isNotBlank) .map(StringUtils::trim) .map(s -> StringUtils.substringBefore(s, ":")) .forEach(ip -> { try { if (network.isLoopbackInetAddress(network.toInetAddress(ip))) { throw new MessageException(format("Property %s must not be a loopback address: %s", propertyKey, ip)); } } catch (UnknownHostException e) { throw new MessageException(format("Property %s must not a valid address: %s [%s]", propertyKey, ip, e.getMessage())); } }); }
result.append(server.get()); } else { result.append(StringUtils.substringBefore(host, ":"));
String format = StringUtils.substringBefore(s, OPTION_SEPARATOR); String values = null; boolean multiple = false;
String qualifier = substringAfter(s, QUALIFIER_SEPARATOR); if (!qualifier.isEmpty()) { s = substringBefore(s, QUALIFIER_SEPARATOR);
private String cleanJdbcUrl() { return StringUtils.lowerCase(StringUtils.substringBefore(db.getUrl(), "?"), Locale.ENGLISH); }
private String extractFileNameFromFileRefValue(final String fileRefValue) { return org.apache.commons.lang.StringUtils.substringBefore( fileRefValue, OpenApiConstants.REFERENCE_PREFIX); }
private String extractFileNameFromFileRefValue(final String fileRefValue) { return org.apache.commons.lang.StringUtils.substringBefore( fileRefValue, SwaggerConstants.REFERENCE_PREFIX); }
fs.delete(new Path(StringUtils.substringBefore(src.toString(), diff)), true); } else { fs.delete(src, true);
public static String extractFilePath(String refValue) { refValue = StringUtils.removeAllQuotes(refValue); return org.apache.commons.lang.StringUtils.substringBefore(refValue, REFERENCE_PREFIX); } }
@Nullable @Override public PsiElement resolve() { final String relativePath = StringUtils.substringBefore(originalRefValue, "#/"); if (relativePath.equals(originalRefValue)) { return resolveExactFileReference(relativePath); } return resolveFileReferenceWithSubPath(relativePath); }
final String trimmedValue = substringBefore(value, "-");
port = StringUtils.substringBefore(port, "/"); LOGGER.log(Level.TRACE, "H2 TCP port [{0}]", port); try {