RequireThis rule and fixThis Gradle task

* `gradlew clean check -x test --parallel --continue` - to collect reports
* `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows

Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`,
therefore we still have to fix those cases manually.
Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems.
Not so easy to fix for good readability though...

* Upgrade to Grade 2.12
* Upgrade to SonarQube native plugin

The fix contains at about 300 files. So, will be done on merge.

Fix `fixThis.gradle` according PR comments

Apply `fixThis` and also `fixModifiers` for test classes.
 Fix some `this.` inner issues manually.
 Make code polishing for long lines after `fixThis`

Fix conflicts and vulnerabilities after the rebase
This commit is contained in:
Artem Bilan
2016-03-17 17:02:15 -04:00
parent e189307ab6
commit 2b0598291c
348 changed files with 1828 additions and 1781 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@@ -206,7 +206,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
.withRoot(requestMessage)
.build();
UriComponents uriComponents = UriComponentsBuilder.fromUriString(uri).buildAndExpand(uriVariables);
UriComponents uriComponents = UriComponentsBuilder.fromUriString(this.uri).buildAndExpand(uriVariables);
return this.encodeUri ? uriComponents.toUri() : new URI(uriComponents.toUriString());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@@ -89,15 +89,15 @@ public class MarshallingWebServiceInboundGateway extends AbstractWebServiceInbou
@Override
protected void onInit() throws Exception {
super.onInit();
Assert.notNull(marshaller, "This implementation requires Marshaller");
Assert.notNull(unmarshaller, "This implementation requires Unmarshaller");
Assert.notNull(this.marshaller, "This implementation requires Marshaller");
Assert.notNull(this.unmarshaller, "This implementation requires Unmarshaller");
}
@Override
protected void doInvoke(MessageContext messageContext) throws Exception{
WebServiceMessage request = messageContext.getRequest();
Assert.notNull(request, "Invalid message context: request was null.");
Object requestObject = MarshallingUtils.unmarshal(unmarshaller, request);
Object requestObject = MarshallingUtils.unmarshal(this.unmarshaller, request);
AbstractIntegrationMessageBuilder<?> builder = this.getMessageBuilderFactory().withPayload(requestObject);
this.fromSoapHeaders(messageContext, builder);
@@ -108,7 +108,7 @@ public class MarshallingWebServiceInboundGateway extends AbstractWebServiceInbou
WebServiceMessage response = messageContext.getResponse();
this.toSoapHeaders(response, replyMessage);
MarshallingUtils.marshal(marshaller, replyMessage.getPayload(), response);
MarshallingUtils.marshal(this.marshaller, replyMessage.getPayload(), response);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -126,7 +126,7 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb
@Override
public void doWithMessageInternal(WebServiceMessage message, Object payload) throws IOException {
MarshallingUtils.marshal(marshaller, payload, message);
MarshallingUtils.marshal(MarshallingWebServiceOutboundGateway.this.marshaller, payload, message);
}
}
@@ -134,7 +134,7 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb
@Override
public Object doExtractData(WebServiceMessage message) throws IOException {
return MarshallingUtils.unmarshal(unmarshaller, message);
return MarshallingUtils.unmarshal(MarshallingWebServiceOutboundGateway.this.unmarshaller, message);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -118,7 +118,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG
if (requestPayload instanceof Source) {
source = (Source) requestPayload;
Object o = sourceExtractor.extractData(source);
Object o = SimpleWebServiceOutboundGateway.this.sourceExtractor.extractData(source);
Assert.isInstanceOf(Source.class, o);
source = (Source) o;
}

View File

@@ -67,7 +67,7 @@ public class WebServiceInboundGatewayParser extends AbstractInboundGatewayParser
if (StringUtils.hasText(marshallerRef) || StringUtils.hasText(unmarshallerRef)){
String extractPayload = element.getAttribute("extract-payload");
if (StringUtils.hasText(extractPayload)) {
logger.warn("Setting 'extract-payload' attribute has no effect when used with a marshalling Web Service Inbound Gateway.");
this.logger.warn("Setting 'extract-payload' attribute has no effect when used with a marshalling Web Service Inbound Gateway.");
}
}
}