Skip to content

Commit 1577b74

Browse files
committed
Quality fixes
1 parent 948cc78 commit 1577b74

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

xmlvalidator-common/src/main/java/eu/europa/ec/itb/xml/validation/DocumentNamespaceContext.java

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

2626
/**
2727
* A namespace context to lookup and map namespaces based on prefix and URI.
28-
*
28+
* <p>
2929
* Implementation based on source found <a href="http://www.ibm.com/developerworks/library/x-nmspccontext/">here</a>.
3030
*/
3131
public class DocumentNamespaceContext implements NamespaceContext {

xmlvalidator-common/src/main/java/eu/europa/ec/itb/xml/validation/XSDFileResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public LSInput resolveResource(String type, String namespaceURI, String publicId
124124
try {
125125
return new LSInputImpl(publicId, systemId, baseURI, new InputStreamReader(new FileInputStream(referencedSchemaFile)));
126126
} catch (FileNotFoundException e) {
127-
LOG.error("The referenced schema with system ID ["+systemId+"] could not be located at ["+referencedSchemaFile.getAbsolutePath()+"].", e);
127+
LOG.error("The referenced schema with system ID [{}] could not be located at [{}].", systemId, referencedSchemaFile.getAbsolutePath(), e);
128128
throw new IllegalStateException("The referenced schema with system ID ["+systemId+"] could not be located.", e);
129129
}
130130
}

xmlvalidator-common/src/main/java/eu/europa/ec/itb/xml/validation/XSDReportHandler.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public XSDReportHandler() {
5656
@Override
5757
public void warning(SAXParseException exception) throws SAXException {
5858
if (logger.isDebugEnabled()) {
59-
logger.debug("warning: <"+exception.getLineNumber() + "," +
60-
exception.getColumnNumber() + ">" + exception.getMessage());
59+
logger.debug("warning: <{},{}>{}", exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
6160
}
6261
BAR warning = new BAR();
6362
warning.setDescription( exception.getMessage());
@@ -75,8 +74,7 @@ public void warning(SAXParseException exception) throws SAXException {
7574
@Override
7675
public void error(SAXParseException exception) throws SAXException {
7776
if (logger.isDebugEnabled()) {
78-
logger.debug("error: <" + exception.getLineNumber() + "," +
79-
exception.getColumnNumber() + ">" + exception.getMessage());
77+
logger.debug("error: <{},{}>{}", exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
8078
}
8179
report.setResult(TestResultType.FAILURE);
8280
BAR error = new BAR();
@@ -95,8 +93,7 @@ public void error(SAXParseException exception) throws SAXException {
9593
@Override
9694
public void fatalError(SAXParseException exception) throws SAXException {
9795
if (logger.isDebugEnabled()) {
98-
logger.debug("fatal error: <" + exception.getLineNumber() + "," +
99-
exception.getColumnNumber() + ">" + exception.getMessage());
96+
logger.debug("fatal error: <{},{}>{}", exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
10097
}
10198
report.setResult(TestResultType.FAILURE);
10299
BAR error = new BAR();

xmlvalidator-common/src/test/java/eu/europa/ec/itb/xml/util/UtilsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import static eu.europa.ec.itb.xml.util.Utils.secureSchemaValidation;
99
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
1010
import static org.junit.jupiter.api.Assertions.assertThrows;
11-
import static org.mockito.ArgumentMatchers.any;
1211
import static org.mockito.Mockito.*;
1312

1413
class UtilsTest {

xmlvalidator-jar/src/main/java/eu/europa/ec/itb/xml/standalone/ValidationRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ protected void bootstrapInternal(String[] args, File parentFolder) {
218218
}
219219
} catch (ValidatorException e) {
220220
LOGGER_FEEDBACK.info("\nAn error occurred while executing the validation: {}", e.getMessageForDisplay(localiser));
221-
LOGGER.error(String.format("An error occurred while executing the validation: %s", e.getMessageForLog()), e);
221+
LOGGER.error("An error occurred while executing the validation: {}", e.getMessageForLog(), e);
222222
break;
223223

224224
} catch (Exception e) {
225225
LOGGER_FEEDBACK.info("\nAn error occurred while executing the validation.");
226-
LOGGER.error(String.format("An error occurred while executing the validation: %s", e.getMessage()), e);
226+
LOGGER.error("An error occurred while executing the validation: {}", e.getMessage(), e);
227227
break;
228228
}
229229
i++;

xmlvalidator-web/src/main/java/eu/europa/ec/itb/xml/upload/UploadController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
262262
result.setMessage(localisationHelper.localise("validator.label.exception.providedInputNotXML"));
263263
}
264264
} catch (IOException e) {
265-
logger.error("Error while reading uploaded file [" + e.getMessage() + "]", e);
265+
logger.error("Error while reading uploaded file [{}]", e.getMessage(), e);
266266
result.setMessage(localisationHelper.localise("validator.label.exception.errorInUpload", e.getMessage()));
267267
proceedToValidate = false;
268268
}
@@ -277,7 +277,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
277277
} catch (ValidatorException e) {
278278
throw e;
279279
} catch (Exception e) {
280-
logger.error("Error while reading uploaded file [" + e.getMessage() + "]", e);
280+
logger.error("Error while reading uploaded file [{}]", e.getMessage(), e);
281281
result.setMessage(localisationHelper.localise("validator.label.exception.errorInUpload", e.getMessage()));
282282
proceedToValidate = false;
283283
}
@@ -317,7 +317,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
317317
fileName, report, aggregateReport,
318318
new Translations(localisationHelper, report, config));
319319
} catch (IOException e) {
320-
logger.error("Error generating detailed report [" + e.getMessage() + "]", e);
320+
logger.error("Error generating detailed report [{}]", e.getMessage(), e);
321321
result.setMessage(localisationHelper.localise("validator.label.exception.errorGeneratingDetailedReport", e.getMessage()));
322322
}
323323
}
@@ -326,7 +326,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
326326
logger.error(e.getMessageForLog(), e);
327327
result.setMessage(e.getMessageForDisplay(localisationHelper));
328328
} catch (Exception e) {
329-
logger.error("An error occurred during the validation [" + e.getMessage() + "]", e);
329+
logger.error("An error occurred during the validation [{}]", e.getMessage(), e);
330330
if (e.getMessage() != null) {
331331
result.setMessage(localisationHelper.localise("validator.label.exception.unexpectedErrorDuringValidationWithParams", e.getMessage()));
332332
} else {

xmlvalidator-ws/src/main/java/eu/europa/ec/itb/xml/ws/ValidationServiceConfig.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515

1616
package eu.europa.ec.itb.xml.ws;
1717

18+
import eu.europa.ec.itb.validation.commons.ValidatorChannel;
1819
import eu.europa.ec.itb.xml.ApplicationConfig;
1920
import eu.europa.ec.itb.xml.DomainConfig;
2021
import eu.europa.ec.itb.xml.DomainConfigCache;
21-
import eu.europa.ec.itb.validation.commons.ValidatorChannel;
22+
import jakarta.annotation.PostConstruct;
2223
import org.apache.commons.lang3.StringUtils;
24+
import org.apache.commons.lang3.Strings;
2325
import org.apache.cxf.Bus;
2426
import org.apache.cxf.jaxws.EndpointImpl;
2527
import org.apache.cxf.transport.servlet.CXFServlet;
@@ -29,7 +31,6 @@
2931
import org.springframework.context.annotation.Bean;
3032
import org.springframework.context.annotation.Configuration;
3133

32-
import jakarta.annotation.PostConstruct;
3334
import javax.xml.namespace.QName;
3435

3536
/**
@@ -72,7 +73,7 @@ public void publishValidationServices() {
7273
endpoint.setEndpointName(new QName("http://www.gitb.com/vs/v1/", "ValidationServicePort"));
7374
endpoint.setServiceName(new QName("http://www.gitb.com/vs/v1/", "ValidationService"));
7475
if (StringUtils.isNotBlank(config.getBaseSoapEndpointUrl())) {
75-
var url = StringUtils.appendIfMissing(config.getBaseSoapEndpointUrl(), "/");
76+
var url = Strings.CS.appendIfMissing(config.getBaseSoapEndpointUrl(), "/");
7677
endpoint.setPublishedEndpointUrl(url+domainConfig.getDomainName()+"/validation");
7778
}
7879
endpoint.publish("/"+domainConfig.getDomainName()+"/validation");

0 commit comments

Comments
 (0)