Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@ public class AggregatedXmlMessageValidationException extends RuntimeException {
private final List<Throwable> exceptions;
public AggregatedXmlMessageValidationException(List<Throwable> exceptions) {
this.exceptions = (exceptions != null) ? exceptions : Collections.emptyList();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,7 +63,6 @@ public class DefaultXmlPayloadConverter implements XmlPayloadConverter {
this.documentBuilderFactory = documentBuilderFactory;
}
@Override
public Document convertToDocument(Object object) {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,6 @@ public class XPathFilterParser extends AbstractConsumerEndpointParser {
private final XPathExpressionParser xpathParser = new XPathExpressionParser();
@Override
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
final BeanDefinitionBuilder selectorBuilder = BeanDefinitionBuilder.genericBeanDefinition();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,6 @@ public class XPathRouterParser extends AbstractRouterParser {
private final XPathExpressionParser xpathParser = new XPathExpressionParser();
@Override
protected BeanDefinition doParseRouter(Element element, ParserContext parserContext) {
BeanDefinitionBuilder xpathRouterBuilder = BeanDefinitionBuilder.genericBeanDefinition(XPathRouter.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class DomResultFactory implements ResultFactory {
private final Lock lock = new ReentrantLock();
public DomResultFactory() {
this(DocumentBuilderFactoryUtils.newInstance());
this.documentBuilderFactory.setNamespaceAware(true);
@@ -54,7 +53,6 @@ public class DomResultFactory implements ResultFactory {
this.documentBuilderFactory = documentBuilderFactory;
}
@Override
public Result createResult(Object payload) {
this.lock.lock();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +122,6 @@ public class XPathRouter extends AbstractMappingMessageRouter {
}
}
private static class TextContentNodeMapper implements NodeMapper<Object> {
TextContentNodeMapper() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@ public abstract class AbstractXPathMessageSelector implements MessageSelector {
private volatile XmlPayloadConverter converter = new DefaultXmlPayloadConverter();
/**
* @param xPathExpression XPath expression as a String
*/
@@ -70,7 +69,6 @@ public abstract class AbstractXPathMessageSelector implements MessageSelector {
this.xPathExpresion = xPathExpression;
}
/**
* Specify the converter used to convert payloads prior to XPath testing.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,6 @@ public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelecto
super(expression);
}
/**
* Return true if the {@link XPathExpression} evaluates to <code>true</code>
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,6 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
private final String regex;
/**
* Creates a selector which attempts to match the given regex and supports multiple namespaces.
*
@@ -92,7 +91,6 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
this.regex = regex;
}
/**
* Evaluate the payload and return true if the value returned by the
* {@link XPathExpression} matches the <code>regex</code>.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@ public class StringValueTestXPathMessageSelector extends AbstractXPathMessageSel
private volatile boolean caseSensitive = true;
/**
* Create a selector which tests for the given value and supports multiple namespaces.
*
@@ -85,7 +84,6 @@ public class StringValueTestXPathMessageSelector extends AbstractXPathMessageSel
this.valueToTestFor = valueToTestFor;
}
/**
* Specify whether comparison of value returned by {@link XPathExpression}
* to test value should be case sensitive. Default is 'true'.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,6 @@ public class XmlValidatingMessageSelector implements MessageSelector {
private XmlPayloadConverter converter = new DefaultXmlPayloadConverter();
/**
* Create a selector with a default {@link XmlValidator}. The validator will be initialized with
* the provided 'schema' location {@link Resource} and 'schemaType'. The valid options for schema
@@ -96,7 +95,6 @@ public class XmlValidatingMessageSelector implements MessageSelector {
this.xmlValidator = xmlValidator;
}
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
this(schema,
StringUtils.hasText(schemaType)
@@ -104,7 +102,6 @@ public class XmlValidatingMessageSelector implements MessageSelector {
: null);
}
public void setThrowExceptionOnRejection(boolean throwExceptionOnRejection) {
this.throwExceptionOnRejection = throwExceptionOnRejection;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,6 @@ public class DomSourceFactory implements SourceFactory {
private final DocumentBuilderFactory documentBuilderFactory;
public DomSourceFactory() {
this(DocumentBuilderFactoryUtils.newInstance());
this.documentBuilderFactory.setNamespaceAware(true);
@@ -60,7 +59,6 @@ public class DomSourceFactory implements SourceFactory {
this.documentBuilderFactory = documentBuilderFactory;
}
public Source createSource(Object payload) {
Source source = null;
if (payload instanceof Document) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,6 @@ public class StringSourceFactory implements SourceFactory {
private final TransformerFactory transformerFactory;
public StringSourceFactory() {
this(TransformerFactoryUtils.newInstance());
}
@@ -60,7 +59,6 @@ public class StringSourceFactory implements SourceFactory {
this.transformerFactory = transformerFactory;
}
public Source createSource(Object payload) {
Source source = null;
if (payload instanceof String) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class MarshallingTransformer extends AbstractXmlTransformer {
private volatile boolean extractPayload = true;
public MarshallingTransformer(Marshaller marshaller, ResultTransformer resultTransformer) {
Assert.notNull(marshaller, "a marshaller is required");
this.marshaller = marshaller;
@@ -54,7 +53,6 @@ public class MarshallingTransformer extends AbstractXmlTransformer {
this(marshaller, null);
}
/**
* Specify whether the source Message's payload should be extracted prior
* to marshalling. This value is set to "true" by default. To send the
@@ -70,7 +68,6 @@ public class MarshallingTransformer extends AbstractXmlTransformer {
return "xml:marshalling-transformer";
}
@Override
public Object doTransform(Message<?> message) {
Object source = (this.extractPayload) ? message.getPayload() : message;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,6 @@ public class ResultToDocumentTransformer implements ResultTransformer {
// Not guaranteed to be thread safe
private final DocumentBuilderFactory documentBuilderFactory;
public ResultToDocumentTransformer() {
this(DocumentBuilderFactoryUtils.newInstance());
this.documentBuilderFactory.setNamespaceAware(true);
@@ -60,7 +59,6 @@ public class ResultToDocumentTransformer implements ResultTransformer {
this.documentBuilderFactory = documentBuilderFactory;
}
public Object transformResult(Result result) {
Document document;
if (DOMResult.class.isAssignableFrom(result.getClass())) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,6 @@ public class ResultToStringTransformer implements ResultTransformer {
private Properties outputProperties;
public ResultToStringTransformer() {
this.transformerFactory = TransformerFactoryUtils.newInstance();
}
@@ -65,7 +64,6 @@ public class ResultToStringTransformer implements ResultTransformer {
this.transformerFactory = transformerFactory;
}
public void setOutputProperties(Properties outputProperties) {
this.outputProperties = outputProperties;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@ public class SourceCreatingTransformer extends AbstractPayloadTransformer<Object
private final SourceFactory sourceFactory;
public SourceCreatingTransformer() {
this.sourceFactory = new DomSourceFactory();
}
@@ -41,7 +40,6 @@ public class SourceCreatingTransformer extends AbstractPayloadTransformer<Object
this.sourceFactory = sourceFactory;
}
@Override
public Source transformPayload(Object payload) {
return this.sourceFactory.createSource(payload);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,6 @@ public class XPathTransformer extends AbstractTransformer {
private volatile NodeMapper<?> nodeMapper;
/**
* Create an {@link XPathTransformer} that will create an XPath expression from the given String
* to be evaluated against converted inbound Message payloads.
@@ -74,7 +73,6 @@ public class XPathTransformer extends AbstractTransformer {
this.xpathExpression = expression;
}
/**
* Specify the expected {@link XPathEvaluationType}. The default is {@link XPathEvaluationType#STRING_RESULT}.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -363,7 +363,6 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
return (Document) domResult.getNode();
}
private Transformer buildTransformer(Message<?> message) throws TransformerException {
// process individual mappings
Transformer transformer = this.templates.newTransformer();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,6 @@ public enum XPathEvaluationType {
}
};
public abstract Object evaluateXPath(XPathExpression expression, Node node);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.integration.xml.xpath;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;