Skip to content

Commit

Permalink
NIFI-13238 Added Checkstyle rules for whitespace
Browse files Browse the repository at this point in the history
This closes #8832

Signed-off-by: David Handermann <exceptionfactory@apache.org>
  • Loading branch information
pvillard31 authored and exceptionfactory committed May 15, 2024
1 parent 63a12b0 commit ee179f4
Show file tree
Hide file tree
Showing 1,046 changed files with 3,548 additions and 3,474 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class C2OperationHandlerProviderTest {
private static C2OperationAck operationAck;

@BeforeAll
public static void setup(){
public static void setup() {
operationAck = new C2OperationAck();
operationAck.setOperationId("12345");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MultiProcessorUseCase implements Serializable {
private List<String> keywords;
private List<ProcessorConfiguration> configurations;

@Schema(description="A description of the use case")
@Schema(description = "A description of the use case")
public String getDescription() {
return description;
}
Expand All @@ -37,7 +37,7 @@ public void setDescription(final String description) {
this.description = description;
}

@Schema(description="Any pertinent notes about the use case")
@Schema(description = "Any pertinent notes about the use case")
public String getNotes() {
return notes;
}
Expand All @@ -46,7 +46,7 @@ public void setNotes(final String notes) {
this.notes = notes;
}

@Schema(description="Keywords that pertain to the use csae")
@Schema(description = "Keywords that pertain to the use csae")
public List<String> getKeywords() {
return keywords;
}
Expand All @@ -55,7 +55,7 @@ public void setKeywords(final List<String> keywords) {
this.keywords = keywords;
}

@Schema(description="A description of how to configure the Processor to perform the task described in the use case")
@Schema(description = "A description of how to configure the Processor to perform the task described in the use case")
public List<ProcessorConfiguration> getConfigurations() {
return configurations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ProcessorConfiguration implements Serializable {
private String processorClassName;
private String configuration;

@Schema(description="The fully qualified classname of the Processor that should be used to accomplish the use case")
@Schema(description = "The fully qualified classname of the Processor that should be used to accomplish the use case")
public String getProcessorClassName() {
return processorClassName;
}
Expand All @@ -35,7 +35,7 @@ public void setProcessorClassName(final String processorClassName) {
this.processorClassName = processorClassName;
}

@Schema(description="A description of how the Processor should be configured in order to accomplish the use case")
@Schema(description = "A description of how the Processor should be configured in order to accomplish the use case")
public String getConfiguration() {
return configuration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition {
private List<MultiProcessorUseCase> multiProcessorUseCases;


@Schema(description="Any input requirements this processor has.")
@Schema(description = "Any input requirements this processor has.")
public InputRequirement.Requirement getInputRequirement() {
return inputRequirement;
}
Expand Down Expand Up @@ -230,7 +230,7 @@ public void setWritesAttributes(List<Attribute> writesAttributes) {
this.writesAttributes = writesAttributes;
}

@Schema(description="A list of use cases that have been documented for this Processor")
@Schema(description = "A list of use cases that have been documented for this Processor")
public List<UseCase> getUseCases() {
return useCases;
}
Expand All @@ -239,7 +239,7 @@ public void setUseCases(final List<UseCase> useCases) {
this.useCases = useCases;
}

@Schema(description="A list of use cases that have been documented that involve this Processor in conjunction with other Processors")
@Schema(description = "A list of use cases that have been documented that involve this Processor in conjunction with other Processors")
public List<MultiProcessorUseCase> getMultiProcessorUseCases() {
return multiProcessorUseCases;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class UseCase implements Serializable {
private String configuration;
private InputRequirement.Requirement inputRequirement;

@Schema(description="A description of the use case")
@Schema(description = "A description of the use case")
public String getDescription() {
return description;
}
Expand All @@ -39,7 +39,7 @@ public void setDescription(final String description) {
this.description = description;
}

@Schema(description="Any pertinent notes about the use case")
@Schema(description = "Any pertinent notes about the use case")
public String getNotes() {
return notes;
}
Expand All @@ -48,7 +48,7 @@ public void setNotes(final String notes) {
this.notes = notes;
}

@Schema(description="Keywords that pertain to the use case")
@Schema(description = "Keywords that pertain to the use case")
public List<String> getKeywords() {
return keywords;
}
Expand All @@ -57,7 +57,7 @@ public void setKeywords(final List<String> keywords) {
this.keywords = keywords;
}

@Schema(description="A description of how to configure the Processor to perform the task described in the use case")
@Schema(description = "A description of how to configure the Processor to perform the task described in the use case")
public String getConfiguration() {
return configuration;
}
Expand All @@ -66,7 +66,7 @@ public void setConfiguration(final String configuration) {
this.configuration = configuration;
}

@Schema(description="Specifies whether an incoming FlowFile is expected for this use case")
@Schema(description = "Specifies whether an incoming FlowFile is expected for this use case")
public InputRequirement.Requirement getInputRequirement() {
return inputRequirement;
}
Expand Down
4 changes: 4 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<module name="WhitespaceAfter"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="WhitespaceAround"/>
<module name="RegexpSinglelineJava">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing whitespace."/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public FlowStatusRunner(PeriodicStatusReporterManager periodicStatusReporterMana
*/
@Override
public int runCommand(String[] args) {
if(args.length == 2) {
if (args.length == 2) {
CMD_LOGGER.info(periodicStatusReporterManager.statusReport(args[1]).toString());
return OK.getStatusCode();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class PeriodicStatusReporter {
* 'reportRunner' prior to this method being called.
*/
public void start() {
if (reportRunner == null){
if (reportRunner == null) {
throw new IllegalStateException("Programmatic error, the reportRunner is still NULL when 'start' was called.");
}
scheduledExecutorService.scheduleAtFixedRate(reportRunner, period, period, TimeUnit.MILLISECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public synchronized void store(OutputStream out, String comments) throws IOExcep
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
super.store(byteArrayOutputStream, comments);

try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), "8859_1"));
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), "8859_1"));
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testOrderedProperties() throws IOException {
try (BufferedReader actualReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())));
BufferedReader expectedReader = new BufferedReader(new InputStreamReader(OrderedPropertiesTest.class.getClassLoader().getResourceAsStream("orderedPropertiesExpected.properties")))) {
String expectedLine;
while((expectedLine = expectedReader.readLine()) != null) {
while ((expectedLine = expectedReader.readLine()) != null) {
String actualLine = actualReader.readLine();
if (!"#Tue Feb 21 11:03:08 EST 2017".equals(expectedLine)) {
assertEquals(expectedLine, actualLine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public int hashCode() {
public String toString() {

StringWriter jsonString = new StringWriter();
try(JsonGenerator generator = objectMapper.getFactory().createGenerator(jsonString)){
try (JsonGenerator generator = objectMapper.getFactory().createGenerator(jsonString)) {
generator.writeStartObject();
generator.writeObjectField("controllerServiceStatusList", controllerServiceStatusList);
generator.writeObjectField("processorStatusList", processorStatusList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public int hashCode() {
@Override
public String toString() {
return "{" +
"id='" + getId()+ '\'' +
"id='" + getId() + '\'' +
"name='" + getName() + '\'' +
", processorHealth=" + processorHealth +
", processorStats=" + processorStats +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public static void verifyLogEntries(String expectedJsonFilename, Container conta
List<ExpectedLogEntry> expectedLogEntries;
try (InputStream inputStream = LogUtil.class.getClassLoader().getResourceAsStream(expectedJsonFilename)) {
List<Map<String, Object>> expected = new ObjectMapper().readValue(inputStream, List.class);
expectedLogEntries = expected.stream().map(map -> new ExpectedLogEntry(Pattern.compile((String)map.get("pattern")), (int) map.getOrDefault("occurrences", 1))).collect(Collectors.toList());
expectedLogEntries = expected
.stream()
.map(map -> new ExpectedLogEntry(Pattern.compile((String) map.get("pattern")), (int) map.getOrDefault("occurrences", 1)))
.collect(Collectors.toList());
}
DockerPort dockerPort = container.port(8000);
logger.info("Connecting to external port {} for docker internal port of {}", new Object[]{dockerPort.getExternalPort(), dockerPort.getInternalPort()});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void shouldModifyProperties() {
}

private void writeBootstrapFile(String property) {
try(BufferedWriter writer = new BufferedWriter(new FileWriter(bootstrapConfigFileLocation))) {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(bootstrapConfigFileLocation))) {
writer.write(property + System.lineSeparator());
writer.write(EXTRA_PROPERTY_KEY + "=" + EXTRA_PROPERTY_VALUE);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BootstrapConfigurationFileTransformerTest {
private static final String BOOTSTRAP_ROOT_KEY_PROPERTY = "minifi.bootstrap.sensitive.key";
private static final String MOCK_KEY = "mockKey";
private static final String BOOTSTRAP_CONF_FILE_WITHOUT_KEY = "/transformer/bootstrap_without_key.conf";
private static final String BOOTSTRAP_CONF_TRANSFORMED= "transformed.conf";
private static final String BOOTSTRAP_CONF_TRANSFORMED = "transformed.conf";

@TempDir
private Path tempDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Map<String, Object> toMap() {
result.put(TYPE_KEY, serviceClass);
result.put(PROPERTIES_KEY, new TreeMap<>(properties));

if(annotationData != null && !annotationData.isEmpty()) {
if (annotationData != null && !annotationData.isEmpty()) {
result.put(ANNOTATION_DATA_KEY, annotationData);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Map<String, Object> toMap() {
result.put(AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY, autoTerminatedRelationshipsList);
result.put(PROPERTIES_KEY, new TreeMap<>(properties));

if(annotationData != null && !annotationData.isEmpty()) {
if (annotationData != null && !annotationData.isEmpty()) {
result.put(ANNOTATION_DATA_KEY, annotationData);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public class ProvenanceRepositorySchema extends BaseSchema implements WritableSc
private String provenanceRepoMaxStorageTime = DEFAULT_PROVENANCE_REPO_MAX_STORAGE_TIME;
private Integer provenanceRepoBufferSize = DEFAULT_PROVENANCE_REPO_BUFFER_SIZE;

public ProvenanceRepositorySchema(){
}
public ProvenanceRepositorySchema() { }

public ProvenanceRepositorySchema(Map map) {
provenanceRepoRolloverTime = getOptionalKeyAsType(map, PROVENANCE_REPO_ROLLOVER_TIME_KEY, String.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static boolean valid(String input) {
public static final String DEFAULT_COMMENT = "";
public static final String DEFAULT_TIMEOUT = "30 secs";
public static final String DEFAULT_YIELD_PERIOD = "10 sec";
public static final String DEFAULT_TRANSPORT_PROTOCOL= "RAW";
public static final String DEFAULT_TRANSPORT_PROTOCOL = "RAW";
public static final String DEFAULT_PROXY_HOST = "";
public static final Integer DEFAULT_PROXY_PORT = null;
public static final String DEFAULT_PROXY_USER = "";
Expand Down Expand Up @@ -99,7 +99,7 @@ public RemoteProcessGroupSchema(Map map) {
yieldPeriod = getOptionalKeyAsType(map, YIELD_PERIOD_KEY, String.class, wrapperName, DEFAULT_YIELD_PERIOD);
transportProtocol = getOptionalKeyAsType(map, TRANSPORT_PROTOCOL_KEY, String.class, wrapperName, DEFAULT_TRANSPORT_PROTOCOL);

if (!TransportProtocolOptions.valid(transportProtocol)){
if (!TransportProtocolOptions.valid(transportProtocol)) {
addValidationIssue(TRANSPORT_PROTOCOL_KEY, wrapperName, "it must be either 'RAW' or 'HTTP' but is '" + transportProtocol + "'");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public List<String> getValidationIssues() {
return validationIssues.stream().sorted().collect(Collectors.toList());
}

@Override
public void addValidationIssue(String issue) {
validationIssues.add(issue);
}
Expand Down Expand Up @@ -96,7 +97,7 @@ <T> T getKeyAsType(Map valueMap, String key, Class<T> targetClass, String wrappe
if (value == null || (targetClass != String.class && "".equals(value))) {
if (defaultValue != null) {
return defaultValue;
} else if(required) {
} else if (required) {
addValidationIssue(key, wrapperName, IT_WAS_NOT_FOUND_AND_IT_IS_REQUIRED);
}
} else {
Expand All @@ -120,7 +121,7 @@ public <T> T getMapAsType(Map valueMap, String key, Class targetClass, String wr
return interpretValueAsType(obj, key, targetClass, wrapperName, required, instantiateIfNull);
}

public <InputT, OutputT> List<OutputT> convertListToType(List<InputT> list, String simpleListType, Class<? extends OutputT> targetClass, String wrapperName){
public <InputT, OutputT> List<OutputT> convertListToType(List<InputT> list, String simpleListType, Class<? extends OutputT> targetClass, String wrapperName) {
if (list == null) {
return new ArrayList<>();
}
Expand Down Expand Up @@ -170,10 +171,10 @@ private <InputT, OutputT> OutputT interpretValueAsType(Class<InputT> inputType,

private <T> T interpretValueAsType(Object obj, String key, Class targetClass, String wrapperName, boolean required, boolean instantiateIfNull) {
if (obj == null || (targetClass != String.class && "".equals(obj))) {
if (required){
if (required) {
addValidationIssue(key, wrapperName, "it is a required property but was not found");
} else {
if(instantiateIfNull) {
if (instantiateIfNull) {
try {
return (T) targetClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected List<ConnectionSchema> getConnectionSchemas(List<ProcessorSchema> proc

protected List<RemoteProcessGroupSchema> getRemoteProcessGroupSchemas() {
Set<UUID> ids = new HashSet<>();
List<RemoteProcessGroupSchema> rpgSchemas= new ArrayList<>(remoteProcessingGroups.size());
List<RemoteProcessGroupSchema> rpgSchemas = new ArrayList<>(remoteProcessingGroups.size());

for (RemoteProcessGroupSchemaV1 rpg : remoteProcessingGroups) {
RemoteProcessGroupSchema rpgSchema = rpg.convert();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public RemoteProcessGroupSchemaV2(Map map) {
yieldPeriod = getOptionalKeyAsType(map, YIELD_PERIOD_KEY, String.class, wrapperName, DEFAULT_YIELD_PERIOD);
transportProtocol = getOptionalKeyAsType(map, TRANSPORT_PROTOCOL_KEY, String.class, wrapperName, DEFAULT_TRANSPORT_PROTOCOL);

if (!TransportProtocolOptions.valid(transportProtocol)){
if (!TransportProtocolOptions.valid(transportProtocol)) {
addValidationIssue(TRANSPORT_PROTOCOL_KEY, wrapperName, "it must be either 'RAW' or 'HTTP' but is '" + transportProtocol + "'");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testTransportProtocol() {

map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, "RAW");
RemoteProcessGroupSchema first = new RemoteProcessGroupSchema(map);
validateIssuesNumMatches(0,first);
validateIssuesNumMatches(0, first);
assertEquals(first.getTransportProtocol(), "RAW");

map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, "HTTP");
Expand All @@ -81,7 +81,7 @@ public void testLocalNetworkInterface() {

map.put(RemoteProcessGroupSchema.LOCAL_NETWORK_INTERFACE_KEY, "eth1");
RemoteProcessGroupSchema first = new RemoteProcessGroupSchema(map);
validateIssuesNumMatches(0,first);
validateIssuesNumMatches(0, first);
assertEquals(first.getLocalNetworkInterface(), "eth1");
}
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testTransportProtocol() {

map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, "RAW");
RemoteProcessGroupSchemaV2 first = new RemoteProcessGroupSchemaV2(map);
validateIssuesNumMatches(0,first);
validateIssuesNumMatches(0, first);
assertEquals(first.getTransportProtocol(), "RAW");

map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, "HTTP");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public interface PropertyContext {
PropertyValue getProperty(PropertyDescriptor descriptor);


Map<String,String> getAllProperties();
Map<String, String> getAllProperties();

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public Date getEndDateTime() {
return new Date(endTimeMillis);
}

public long getTimeDifferenceMillis(){
public long getTimeDifferenceMillis() {
return endTimeMillis - startTimeMillis;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface StatusAnalytics {
* is the value for the prediction
* @return map
*/
Map<String,Long> getPredictions();
Map<String, Long> getPredictions();

/**
* Return if analytics object supports online learning
Expand Down

0 comments on commit ee179f4

Please sign in to comment.