Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ReportingSchema extends BaseSchemaWithIdAndName {

public ReportingSchema(Map map) {
super(map, "Reporting(id: {id}, name: {name})");
if (this.getId().equals("")) {
if (this.getId().isEmpty()) {
// MiNiFi will throw an error if it can not find `id` of BaseSchemaWithIdAndName for YML config version 3
this.setId(UUID.randomUUID().toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public String toString() {

@Override
public ControllerService asControllerService() {
if (rawValue == null || rawValue.equals("") || serviceLookup == null) {
if (rawValue == null || rawValue.isEmpty() || serviceLookup == null) {
return null;
}

Expand All @@ -197,7 +197,7 @@ public <T extends ControllerService> T asControllerService(final Class<T> servic
if (!serviceType.isInterface()) {
throw new IllegalArgumentException("ControllerServices may be referenced only via their interfaces; " + serviceType + " is not an interface");
}
if (rawValue == null || rawValue.equals("") || serviceLookup == null) {
if (rawValue == null || rawValue.isEmpty() || serviceLookup == null) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ private SecretsManagerClient getDefaultClient() {
}

private static boolean isNotBlank(final String value) {
return value != null && !value.trim().equals("");
return value != null && !value.isBlank();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ default String convertFolderName(String folderName) {
default String getParentPath(String fullPath) {
final int idx = fullPath.lastIndexOf("/");
final String parentPath = fullPath.substring(0, idx);
return "".equals(parentPath) ? "/" : parentPath;
return parentPath.isEmpty() ? "/" : parentPath;
}

default Map<String, String> createAttributeMap(FileMetadata fileMetadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public static void setParameter(final PreparedStatement stmt, final int paramete
case DATE:
java.sql.Date date;

if (valueFormat.equals("")) {
if (valueFormat.isEmpty()) {
if (LONG_PATTERN.matcher(parameterValue).matches()) {
date = new java.sql.Date(Long.parseLong(parameterValue));
} else {
Expand All @@ -827,7 +827,7 @@ public static void setParameter(final PreparedStatement stmt, final int paramete
case TIME:
Time time;

if (valueFormat.equals("")) {
if (valueFormat.isEmpty()) {
if (LONG_PATTERN.matcher(parameterValue).matches()) {
time = new Time(Long.parseLong(parameterValue));
} else {
Expand All @@ -848,7 +848,7 @@ public static void setParameter(final PreparedStatement stmt, final int paramete
Timestamp ts;

// Backwards compatibility note: Format was unsupported for a timestamp field.
if (valueFormat.equals("")) {
if (valueFormat.isEmpty()) {
long lTimestamp = 0L;
if (LONG_PATTERN.matcher(parameterValue).matches()) {
lTimestamp = Long.parseLong(parameterValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ValidationResult validate(String subject, String input, ValidationContext
}

private String isValidEventType(String input) {
if (input != null && !"".equals(input.trim())) {
if (input != null && !input.isBlank()) {
final String[] events = input.split(",");
final List<String> invalid = new ArrayList<>();
for (String event : events) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro
StateMap state = session.getState(Scope.CLUSTER);
String txIdAsString = state.get(LAST_TX_ID);

if (txIdAsString != null && !"".equals(txIdAsString)) {
if (txIdAsString != null && !txIdAsString.isEmpty()) {
lastTxId = Long.parseLong(txIdAsString);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected boolean determineListable(final FileStatus status) {

String getAbsolutePath(final Path path) {
final Path parent = path.getParent();
final String prefix = (parent == null || parent.getName().equals("")) ? "" : getAbsolutePath(parent);
final String prefix = (parent == null || parent.getName().isEmpty()) ? "" : getAbsolutePath(parent);
return prefix + "/" + path.getName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static String serialize(final Criteria criteria) {
public static Criteria deserialize(final String string) {
Criteria criteria = null;

if (string != null && !string.trim().equals("")) {
if (string != null && !string.isBlank()) {
try {
// deserialize the binding
final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ public static RepositoryConfiguration create(final NiFiProperties nifiProperties
config.setMaxAttributeChars(maxAttrChars);
config.setConcurrentMergeThreads(concurrentMergeThreads);

if (warmCacheFrequency != null && !warmCacheFrequency.trim().equals("")) {
if (warmCacheFrequency != null && !warmCacheFrequency.isBlank()) {
config.setWarmCacheFrequencyMinutes((int) FormatUtils.getTimeDuration(warmCacheFrequency, TimeUnit.MINUTES));
}
if (shardSize != null) {
config.setDesiredIndexSize(DataUnit.parseDataSize(shardSize, DataUnit.B).longValue());
}
if (maintenanceFrequency != null && !maintenanceFrequency.trim().equals("")) {
if (maintenanceFrequency != null && !maintenanceFrequency.isBlank()) {
final long millis = FormatUtils.getTimeDuration(maintenanceFrequency.trim(), TimeUnit.MILLISECONDS);
config.setMaintenanceFrequency(millis, TimeUnit.MILLISECONDS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public FlowConfigurationArchiveManager(final NiFiProperties properties) {
final Path archiveDirectory;
if (archiveDirVal == null || archiveDirVal.isBlank()) {
File persistenceFile = properties.getFlowConfigurationFile();
archiveDirectory = (archiveDirVal == null || archiveDirVal.equals(""))
archiveDirectory = (archiveDirVal == null || archiveDirVal.isEmpty())
? persistenceFile.toPath().getParent().resolve("archive") : new File(archiveDirVal).toPath();
} else {
archiveDirectory = Paths.get(archiveDirVal);
Expand Down
Loading