Skip to content

Commit 34769da

Browse files
committed
Quality fixes
1 parent 55ed9e2 commit 34769da

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/InputHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* Component to facilitate the validation and preparation of inputs.
27-
*
27+
* <p>
2828
* This class serves simply as a marked to include the parent component as-is.
2929
*/
3030
@Component

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/JSONValidator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import eu.europa.ec.itb.validation.plugin.PluginManager;
3636
import eu.europa.ec.itb.validation.plugin.ValidationPlugin;
3737
import org.apache.commons.io.FileUtils;
38-
import org.apache.commons.lang3.StringUtils;
38+
import org.apache.commons.lang3.Strings;
3939
import org.apache.commons.lang3.tuple.Pair;
4040
import org.slf4j.Logger;
4141
import org.slf4j.LoggerFactory;
@@ -376,7 +376,7 @@ private Function<ValidationMessage, String> getLocationMapper() {
376376
private List<Message> validateAgainstSchema(File schemaFile) {
377377
var schemaInfo = readSchema(schemaFile.toPath());
378378
var locationMapper = getLocationMapper();
379-
return schemaInfo.getLeft().validate(getContentNode(schemaInfo.getRight())).stream().map(message -> new Message(StringUtils.removeStart(message.getMessage(), "[] "), locationMapper.apply(message))).toList();
379+
return schemaInfo.getLeft().validate(getContentNode(schemaInfo.getRight())).stream().map(message -> new Message(Strings.CS.removeStart(message.getMessage(), "[] "), locationMapper.apply(message))).toList();
380380
}
381381

382382
/**

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/LocalSchemaCache.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
import eu.europa.ec.itb.json.ApplicationConfig;
2020
import eu.europa.ec.itb.json.DomainConfig;
2121
import eu.europa.ec.itb.json.DomainConfigCache;
22+
import jakarta.annotation.PostConstruct;
2223
import org.apache.commons.io.FilenameUtils;
23-
import org.apache.commons.lang3.StringUtils;
24+
import org.apache.commons.lang3.Strings;
2425
import org.slf4j.Logger;
2526
import org.slf4j.LoggerFactory;
2627
import org.springframework.beans.factory.annotation.Autowired;
2728
import org.springframework.stereotype.Component;
2829

29-
import jakarta.annotation.PostConstruct;
3030
import java.io.File;
3131
import java.io.FileReader;
3232
import java.io.IOException;
@@ -139,7 +139,7 @@ private void readSchemaIdsAndPaths(DomainConfig domainConfig) throws IOException
139139
* @return The key to use.
140140
*/
141141
private String schemaKey(DomainConfig domainConfig, String id) {
142-
return StringUtils.appendIfMissing(String.format("com.gitb.domain.%s|%s", domainConfig.getDomain(), id), "#");
142+
return Strings.CS.appendIfMissing(String.format("com.gitb.domain.%s|%s", domainConfig.getDomain(), id), "#");
143143
}
144144

145145
/**

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/LocalSchemaResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.networknt.schema.resource.SchemaLoader;
2121
import com.networknt.schema.resource.UriSchemaLoader;
2222
import eu.europa.ec.itb.json.DomainConfig;
23-
import org.apache.commons.lang3.StringUtils;
23+
import org.apache.commons.lang3.Strings;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

@@ -56,7 +56,7 @@ public LocalSchemaResolver(DomainConfig domain, LocalSchemaCache localSchemaCach
5656
*/
5757
@Override
5858
public InputStreamSource getSchema(AbsoluteIri absoluteIri) {
59-
String idToCheck = StringUtils.appendIfMissing(absoluteIri.toString(), "#");
59+
String idToCheck = Strings.CS.appendIfMissing(absoluteIri.toString(), "#");
6060
var schema = localSchemaCache.getSchemaForId(domain, idToCheck);
6161
if (schema.isEmpty()) {
6262
LOG.debug("Schema with URI {} not found locally. Looking up remotely.", absoluteIri);

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/SchemaResolutionState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/**
2424
* Class to record the thread-specific state when resolving a given schema.
25-
*
25+
* <p>
2626
* This state is used for two reasons:
2727
* - To pass the domain in question.
2828
* - To ensure that we don't end up with cyclic dependencies that could lead to infinite lookups.

jsonvalidator-jar/src/main/java/eu/europa/ec/itb/json/standalone/ValidationRunner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ protected void bootstrapInternal(String[] args, File parentFolder) {
118118
externalSchemaCombinationApproach = inputHelper.getValidationArtifactCombinationApproach(domainConfig, validationType, schemaCombinationApproachValue);
119119
} catch (ValidatorException e) {
120120
LOGGER_FEEDBACK.info("\nInvalid arguments provided: {}\n", e.getMessageForDisplay(new LocalisationHelper(domainConfig, Locale.ENGLISH)));
121-
LOGGER.error(String.format("Invalid arguments provided: %s", e.getMessageForLog()), e);
121+
LOGGER.error("Invalid arguments provided: {}", e.getMessageForLog(), e);
122122
inputs.clear();
123123
} catch (IllegalArgumentException e) {
124124
LOGGER_FEEDBACK.info("\nInvalid arguments provided: {}\n", e.getMessage());
125-
LOGGER.error(String.format("Invalid arguments provided: %s", e.getMessage()), e);
125+
LOGGER.error("Invalid arguments provided: {}", e.getMessage(), e);
126126
inputs.clear();
127127
} catch (Exception e) {
128128
LOGGER_FEEDBACK.info("\nAn error occurred while processing the provided arguments.\n");
@@ -177,12 +177,12 @@ protected void bootstrapInternal(String[] args, File parentFolder) {
177177
}
178178
} catch (ValidatorException e) {
179179
LOGGER_FEEDBACK.info("\nAn error occurred while executing the validation: {}", e.getMessageForDisplay(localiser));
180-
LOGGER.error(String.format("An error occurred while executing the validation: %s", e.getMessageForLog()), e);
180+
LOGGER.error("An error occurred while executing the validation: {}", e.getMessageForLog(), e);
181181
break;
182182

183183
} catch (Exception e) {
184184
LOGGER_FEEDBACK.info("\nAn error occurred while executing the validation.");
185-
LOGGER.error(String.format("An error occurred while executing the validation: %s", e.getMessage()), e);
185+
LOGGER.error("An error occurred while executing the validation: {}", e.getMessage(), e);
186186
break;
187187
}
188188
i++;

jsonvalidator-service/src/main/java/eu/europa/ec/itb/json/gitb/ValidationServiceConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import eu.europa.ec.itb.validation.commons.ValidatorChannel;
2222
import jakarta.annotation.PostConstruct;
2323
import org.apache.commons.lang3.StringUtils;
24+
import org.apache.commons.lang3.Strings;
2425
import org.apache.cxf.Bus;
2526
import org.apache.cxf.jaxws.EndpointImpl;
2627
import org.apache.cxf.transport.servlet.CXFServlet;
@@ -77,7 +78,7 @@ public void publishValidationServices() {
7778
endpoint.setEndpointName(new QName("http://www.gitb.com/vs/v1/", "ValidationServicePort"));
7879
endpoint.setServiceName(new QName("http://www.gitb.com/vs/v1/", "ValidationService"));
7980
if (StringUtils.isNotBlank(config.getBaseSoapEndpointUrl())) {
80-
var url = StringUtils.appendIfMissing(config.getBaseSoapEndpointUrl(), "/");
81+
var url = Strings.CS.appendIfMissing(config.getBaseSoapEndpointUrl(), "/");
8182
endpoint.setPublishedEndpointUrl(url+domainConfig.getDomainName()+"/validation");
8283
}
8384
endpoint.publish("/"+domainConfig.getDomainName()+"/validation");

jsonvalidator-service/src/main/java/eu/europa/ec/itb/json/gitb/ValidationServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private boolean definesTypeWithExternalSchemas() {
128128

129129
/**
130130
* The validate operation is called to validate the input and produce a validation report.
131-
*
131+
* <p>
132132
* The expected input is described for the service's client through the getModuleDefinition call.
133133
*
134134
* @param validateRequest The input parameters and configuration for the validation.

0 commit comments

Comments
 (0)