Skip to content

Commit

Permalink
Merge pull request #23 from Financial-Times/fix-some-warnings
Browse files Browse the repository at this point in the history
Fix some warnings related to deprecate mainly
  • Loading branch information
denisacostaq committed Apr 8, 2022
2 parents bc54041 + 059719c commit 97ff05f
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ISODateTimeFormatter implements DateTimeFormatter {

@Override
public String format(ReadableDateTime readableDateTime) {
notNull(readableDateTime);
notNull(readableDateTime, "readableDateTime should not be null");
return readableDateTime
.toDateTime()
.withZone(DateTimeZone.UTC)
Expand All @@ -22,7 +22,7 @@ public String format(ReadableDateTime readableDateTime) {

@Override
public ReadableDateTime parseDateTime(String dateTime) {
notNull(dateTime);
notNull(dateTime, "dateTime should not be null");
return DEFAULT_DATE_FORMATTER.parseDateTime(dateTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ISODateTimeWithMillisFormatter implements DateTimeFormatter {

@Override
public String format(ReadableDateTime readableDateTime) {
notNull(readableDateTime);
notNull(readableDateTime, "readableDateTime should not be null");
return readableDateTime
.toDateTime()
.withZone(DateTimeZone.UTC)
Expand All @@ -22,7 +22,7 @@ public String format(ReadableDateTime readableDateTime) {

@Override
public ReadableDateTime parseDateTime(String dateTime) {
notNull(dateTime);
notNull(dateTime, "dateTime should not be null");
return DEFAULT_DATE_FORMATTER.parseDateTime(dateTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public JsonDateTimeSerializer() {
}

JsonDateTimeSerializer(DateTimeFormatter dateTimeFormatter) {
notNull(dateTimeFormatter);
notNull(dateTimeFormatter, "dateTimeFormatter should not be null");
super.dateTimeFormatter = dateTimeFormatter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public JsonDateTimeWithMillisSerializer() {
}

JsonDateTimeWithMillisSerializer(DateTimeFormatter dateTimeFormatter) {
notNull(dateTimeFormatter);
notNull(dateTimeFormatter, "dateTimeFormatter should not be null");
super.dateTimeFormatter = dateTimeFormatter;
}
}
8 changes: 5 additions & 3 deletions core/src/main/java/com/ft/api/ucm/core/net/UrlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.springframework.web.util.UriComponentsBuilder;

/**
* Internal class for building URLs based on a {@link RequestUrl} or an {@link HttpServletRequest}.
* Internal class for building URLs based on a {@link URL} or an {@link HttpServletRequest}.
*
* @author andrew.winter
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ private UrlBuilder(HttpServletRequest request, boolean includeParameters) {

/** Create a new UrlBuilder from an HttpServletRequest */
public static UrlBuilder basedOn(HttpServletRequest request, boolean includeParameters) {
notNull(request);
notNull(request, "request should not be null");
return new UrlBuilder(request, includeParameters);
}

Expand All @@ -82,7 +82,9 @@ public UrlBuilder overridePaths(String servletPath) {
}

public UrlBuilder withScheme(String scheme) {
Assert.isTrue(HTTP.equalsIgnoreCase(scheme) || HTTPS.equalsIgnoreCase(scheme));
Assert.isTrue(
HTTP.equalsIgnoreCase(scheme) || HTTPS.equalsIgnoreCase(scheme),
"scheme should be http or https");
this.scheme = scheme.toLowerCase();
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ArticleEntity() {}

public ArticleEntity(String id, String apiUrl) {
super(id, apiUrl);
notNull(apiUrl);
notNull(apiUrl, "apiUrl should not be null");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion model/src/main/java/com/ft/api/ucm/model/v1/Identity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private Identity(String value) {
}

public static Identity fromValue(String value) {
Assert.hasText(value);
Assert.hasText(value, "value should not be null");
return new Identity(value);
}

Expand Down
4 changes: 2 additions & 2 deletions model/src/main/java/com/ft/api/ucm/model/v1/MasterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class MasterImpl implements Master {
public MasterImpl() {}

public MasterImpl(String masterEntityId, MasterSource masterSource) {
notNull(masterSource);
hasText(masterEntityId);
notNull(masterSource, "masterSource should not be null");
hasText(masterEntityId, "masterEntityId should not be null");
this.masterEntityId = masterEntityId;
this.masterSource = masterSource;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public SlideshowArticleEntity() {}

public SlideshowArticleEntity(String id, String apiUrl) {
super(id, apiUrl);
notNull(apiUrl);
notNull(apiUrl, "apiUrl should not be null");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public final class CompositeField implements Field {
private NamedNode<Field> namedNode;

public CompositeField(String name, Set<Field> fields, AssignableVoter assignableVoter) {
notNull(assignableVoter);
namedNode = new NamedNode<Field>(name, fields);
notNull(assignableVoter, "assignableVoter should not be null");
namedNode = new NamedNode<>(name, fields);
this.assignableVoter = assignableVoter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HardwiredAspectSetSelectionPolicy implements AspectSetSelectionPolicy {
private AspectSet defaultAspectSet;

public HardwiredAspectSetSelectionPolicy(AspectSet defaultAspectSet) {
Assert.notNull(defaultAspectSet);
Assert.notNull(defaultAspectSet, "defaultAspectSet should not be null");
this.defaultAspectSet = defaultAspectSet;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public final class ImmutableAspect implements Aspect {
private NamedNode<Field> namedNode;

private ImmutableAspect(String name, Set<Field> fields, AssignableVoter assignableVoter) {
notNull(assignableVoter);
notNull(AspectEnum.getByValue(name));
namedNode = new NamedNode<Field>(name, fields);
notNull(assignableVoter, "assignableVoter should not be null");
notNull(AspectEnum.getByValue(name), String.format("Unable to find aspect by name %s", name));
namedNode = new NamedNode<>(name, fields);
this.assignableVoter = assignableVoter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public String apply(Aspect input) {
private NamedNode<Aspect> namedNode;

private ImmutableAspectSet(String name, Set<Aspect> aspects, AssignableVoter assignableVoter) {
notNull(assignableVoter);
notNull(assignableVoter, "assignableVoter should not be null");
namedNode = new NamedNode<Aspect>(name, aspects);
this.assignableVoter = assignableVoter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public final class ImmutableField implements Field {
private final FieldResolutionPolicy fieldResolutionPolicy;

private ImmutableField(String name, FieldResolutionPolicy fieldResolutionPolicy) {
notNull(name);
notNull(fieldResolutionPolicy);
notNull(name, "name should not be null");
notNull(fieldResolutionPolicy, "fieldResolutionPolicy should not be null");
this.name = name;
this.fieldResolutionPolicy = fieldResolutionPolicy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final class NamedNode<C> implements Node<C> {
private Set<C> children;

public NamedNode(String name, Set<C> children) {
notNull(name);
notNull(children);
notNull(name, "name should not be null");
notNull(children, "children should not be null");
this.name = name;
this.children = sortedCopy(children);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class PolicyBasedAspectSetCollection implements AspectSetCollection {

public PolicyBasedAspectSetCollection(
Set<AspectSet> aspectSets, AspectSetSelectionPolicy aspectSetSelectionPolicy) {
notNull(aspectSets);
notNull(aspectSetSelectionPolicy);
notNull(aspectSets, "aspectSets should not be null");
notNull(aspectSetSelectionPolicy, "aspectSetSelectionPolicy should not be null");
this.aspectSets = aspectSets;
this.aspectSetSelectionPolicy = aspectSetSelectionPolicy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class AttributeImpl implements Attribute, Comparable<AttributeImpl> {
public AttributeImpl() {}

public AttributeImpl(String key, String value) {
Assert.notNull(key);
Assert.notNull(value);
Assert.notNull(key, "key should not be null");
Assert.notNull(value, "value should not be null");
this.key = key;
this.value = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ public class ContentItemReference implements NotificationReference, Serializable
private String id;
private String apiUrl;

public ContentItemReference() {}

public ContentItemReference(String id, String apiUrl) {
this.id = id;
this.apiUrl = apiUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ContentNotificationsTemplate {
private final String urlTemplate;

public ContentNotificationsTemplate(String baseApiUrl) {
Assert.notNull(baseApiUrl);
Assert.notNull(baseApiUrl, "baseApiUrl should not be null");
this.urlTemplate = baseApiUrl + URL_TEMPLATE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static net.obvj.junit.utils.matchers.AdvancedMatchers.throwsException;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import com.ft.api.ucm.model.v1.AspectSetAware;
import java.util.Set;
Expand Down Expand Up @@ -32,6 +32,6 @@ public void ifSuppliedAspectSetIsNullExceptionThrown() {
public void sameAspectSetReturnedAlways() {
instance = new HardwiredAspectSetSelectionPolicy(mockAspectSet);
assertEquals(mockAspectSet, instance.match(mockAspectSets, mockAspectSetAware.getClass()));
verifyZeroInteractions(mockAspectSets);
verifyNoMoreInteractions(mockAspectSets);
}
}
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import org.springframework.web.filter.OncePerRequestFilter;

/**
* A {@link Filter} that decorates the {@link HttpServletResponse} to supportLogger sent HTTP
* errors.
* A {@link OncePerRequestFilter} that decorates the {@link HttpServletResponse} to supportLogger
* sent HTTP errors.
*
* @author andrew.winter
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ResponseHeaderSettingFilter extends OncePerRequestFilter {
private List<ResponseHeader> responseHeaders;

public ResponseHeaderSettingFilter(List<ResponseHeader> responseHeaders) {
Assert.notEmpty(responseHeaders);
Assert.notEmpty(responseHeaders, "responseHeaders should not be null");
this.responseHeaders = ImmutableList.copyOf(responseHeaders);
}

Expand Down

0 comments on commit 97ff05f

Please sign in to comment.