Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit dd1d62b

Browse files
DATASOLR-361 - Remove references to single-argument assertion methods.
1 parent 4e8149a commit dd1d62b

24 files changed

+78
-76
lines changed

src/main/java/org/springframework/data/solr/core/SolrTemplate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -183,7 +183,7 @@ public SolrTemplate(SolrClientFactory solrClientFactory, SolrConverter solrConve
183183
*/
184184
@Override
185185
public <T> T execute(SolrCallback<T> action) {
186-
Assert.notNull(action);
186+
Assert.notNull(action, "SolrCallback must not be null!");
187187

188188
try {
189189
SolrClient solrClient = this.getSolrClient();
@@ -202,7 +202,7 @@ public <T> T execute(SolrCallback<T> action) {
202202
@Override
203203
public <T> T execute(String collection, CollectionCallback<T> action) {
204204

205-
Assert.notNull(action);
205+
Assert.notNull(action, "Action must not be null!");
206206

207207
try {
208208

src/main/java/org/springframework/data/solr/core/convert/CustomConversions.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2014 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ public CustomConversions(List converters) {
9898
* @param conversionService must not be null
9999
*/
100100
public void registerConvertersIn(GenericConversionService conversionService) {
101-
Assert.notNull(conversionService);
101+
Assert.notNull(conversionService, "ConversionService must not be null!");
102102

103103
for (Object converter : converters) {
104104
if (converter instanceof Converter) {
@@ -140,13 +140,13 @@ public Class<?> getCustomWriteTarget(Class<?> source) {
140140
* @return
141141
*/
142142
public Class<?> getCustomWriteTarget(Class<?> sourceType, Class<?> targetType) {
143-
Assert.notNull(sourceType);
143+
Assert.notNull(sourceType, "SourceType must not be null!");
144144
return getCustomTarget(sourceType, targetType, writingPairs);
145145
}
146146

147147
Class<?> getCustomTarget(Class<?> sourceType, Class<?> expectedTargetType, Iterable<ConvertiblePair> pairs) {
148-
Assert.notNull(sourceType);
149-
Assert.notNull(pairs);
148+
Assert.notNull(sourceType, "SourceType must not be null!");
149+
Assert.notNull(pairs, "Pairs of ConvertiblePairs must not be null!");
150150

151151
ConvertiblePair expectedTypePair = new ConvertiblePair(sourceType, expectedTargetType != null ? expectedTargetType
152152
: Any.class);
@@ -178,8 +178,8 @@ Class<?> getCustomTarget(Class<?> sourceType, Class<?> expectedTargetType, Itera
178178
* @return true if custom converter registered for source/target type
179179
*/
180180
public boolean hasCustomReadTarget(Class<?> sourceType, Class<?> targetType) {
181-
Assert.notNull(sourceType);
182-
Assert.notNull(targetType);
181+
Assert.notNull(sourceType, "SourceType must not be null!");
182+
Assert.notNull(targetType, "TargetType must not be null!");
183183

184184
return getCustomReadTarget(sourceType, targetType) != null;
185185
}
@@ -252,7 +252,7 @@ static class ConvertibleContext {
252252
* @param isWriting
253253
*/
254254
public ConvertibleContext(ConvertiblePair convertible, boolean isReading, boolean isWriting) {
255-
Assert.notNull(convertible);
255+
Assert.notNull(convertible, "ConvertiblePair must not be null!");
256256
this.convertible = convertible;
257257
this.reading = isReading;
258258
this.writing = isWriting;

src/main/java/org/springframework/data/solr/core/convert/MappingSolrConverter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@
5353
import org.springframework.util.CollectionUtils;
5454

5555
/**
56-
* Implementation of {@link SolrConverter} to read/write {@link org.apache.solr.common.SolrDocumen}/
56+
* Implementation of {@link SolrConverter} to read/write {@link org.apache.solr.common.SolrDocument}/
5757
* {@link SolrInputDocument}. <br/>
5858
*
5959
* @author Christoph Strobl
@@ -129,7 +129,7 @@ String removeWildcard(String fieldName) {
129129

130130
public MappingSolrConverter(
131131
MappingContext<? extends SolrPersistentEntity<?>, SolrPersistentProperty> mappingContext) {
132-
Assert.notNull(mappingContext);
132+
Assert.notNull(mappingContext, "MappingContext must not be null!");
133133

134134
this.mappingContext = mappingContext;
135135
}
@@ -164,7 +164,7 @@ protected <S extends Object> S read(TypeInformation<S> targetTypeInformation, Ma
164164
if (source == null) {
165165
return null;
166166
}
167-
Assert.notNull(targetTypeInformation);
167+
Assert.notNull(targetTypeInformation, "TargetTypeInformation must not be null!");
168168
Class<S> rawType = targetTypeInformation.getType();
169169

170170
// in case there's a custom conversion for the document
@@ -445,7 +445,7 @@ private <T> T readValue(Object value, TypeInformation<?> type, Object parent) {
445445
return null;
446446
}
447447

448-
Assert.notNull(type);
448+
Assert.notNull(type, "TypeInformation must not be null!");
449449
Class<?> rawType = type.getType();
450450
if (hasCustomReadTarget(value.getClass(), rawType)) {
451451
return (T) convert(value, rawType);
@@ -600,7 +600,7 @@ private Object readValue(SolrPersistentProperty property, Object o, Object paren
600600
}
601601

602602
private Object readCollection(Collection<?> source, TypeInformation<?> type, Object parent) {
603-
Assert.notNull(type);
603+
Assert.notNull(type, "Type must not be null!");
604604

605605
Class<?> collectionType = type.getType();
606606
if (CollectionUtils.isEmpty(source)) {

src/main/java/org/springframework/data/solr/core/convert/SolrjConverters.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2014 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -92,8 +92,8 @@ public SolrInputDocument convert(Update source) {
9292
if (source == null) {
9393
return null;
9494
}
95-
Assert.notNull(source.getIdField());
96-
Assert.hasText(source.getIdField().getName());
95+
Assert.notNull(source.getIdField(), "Id field must not be null!");
96+
Assert.hasText(source.getIdField().getName(), "Name of Id field must not be null nor empty!");
9797

9898
SolrInputDocument solrInputDocument = new SolrInputDocument();
9999
solrInputDocument.addField(source.getIdField().getName(), source.getIdField().getValue());

src/main/java/org/springframework/data/solr/core/query/Criteria.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2014 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -497,7 +497,7 @@ public Criteria in(Iterable<?> values) {
497497
* @return
498498
*/
499499
public Criteria within(Point location, Distance distance) {
500-
Assert.notNull(location);
500+
Assert.notNull(location, "Location must not be null!");
501501
assertPositiveDistanceValue(distance);
502502
predicates.add(new Predicate(OperationKey.WITHIN, new Object[] { location,
503503
distance != null ? distance : new Distance(0) }));

src/main/java/org/springframework/data/solr/core/query/FacetOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -179,7 +179,7 @@ public final FacetOptions addFacetOnPivot(String... fieldnames) {
179179
* @return
180180
*/
181181
public final FacetOptions addFacetOnFlieldnames(Collection<String> fieldnames) {
182-
Assert.notNull(fieldnames);
182+
Assert.notNull(fieldnames, "Fieldnames must not be null!");
183183

184184
for (String fieldname : fieldnames) {
185185
addFacetOnField(fieldname);

src/main/java/org/springframework/data/solr/core/query/FieldWithQueryParameters.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2013 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class FieldWithQueryParameters<T extends QueryParameter> extends SimpleFi
3636
*/
3737
public FieldWithQueryParameters(String fieldname) {
3838
super(fieldname);
39-
Assert.hasText(fieldname);
39+
Assert.hasText(fieldname, "Fieldname must not be null nor empty!");
4040
}
4141

4242
/**
@@ -53,7 +53,7 @@ public T getQueryParameter(String parameterName) {
5353
* @param parameter must not be null
5454
*/
5555
public void addQueryParameter(T parameter) {
56-
Assert.notNull(parameter);
56+
Assert.notNull(parameter, "Parameter must not be null!");
5757
this.parameterHolder.add(parameter);
5858
}
5959

src/main/java/org/springframework/data/solr/core/query/HighlightOptions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public String getName() {
5151
* @return
5252
*/
5353
public HighlightOptions addField(Field field) {
54-
Assert.notNull(field);
54+
Assert.notNull(field, "Field must not be null!");
5555
this.fields.add(field);
5656
return this;
5757
}
@@ -63,7 +63,7 @@ public HighlightOptions addField(Field field) {
6363
* @return
6464
*/
6565
public HighlightOptions addField(String fieldname) {
66-
Assert.hasText(fieldname);
66+
Assert.hasText(fieldname, "Fieldname must not be null nor empty!");
6767
return addField(new SimpleField(fieldname));
6868
}
6969

@@ -74,7 +74,7 @@ public HighlightOptions addField(String fieldname) {
7474
* @return
7575
*/
7676
public HighlightOptions addField(String... fieldnames) {
77-
Assert.notNull(fieldnames);
77+
Assert.notNull(fieldnames, "Fieldnames must not be null!");
7878

7979
for (String fieldname : fieldnames) {
8080
addField(fieldname);
@@ -89,7 +89,7 @@ public HighlightOptions addField(String... fieldnames) {
8989
* @return
9090
*/
9191
public HighlightOptions addFields(Collection<String> fieldnames) {
92-
Assert.notNull(fieldnames);
92+
Assert.notNull(fieldnames, "Fieldnames must not be null!");
9393

9494
for (String fieldname : fieldnames) {
9595
addField(fieldname);
@@ -231,7 +231,7 @@ public HighlightOptions addHighlightParameter(String parameterName, Object value
231231
* @return
232232
*/
233233
public HighlightOptions addHighlightParameter(HighlightParameter parameter) {
234-
Assert.notNull(parameter);
234+
Assert.notNull(parameter, "Parameter must not be null!");
235235
this.parameterHolder.add(parameter);
236236
return this;
237237
}

src/main/java/org/springframework/data/solr/core/query/Join.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ public static class Builder {
9494
private Join join;
9595

9696
public Builder(Field from) {
97-
Assert.notNull(from);
97+
Assert.notNull(from, "From must not be null!");
9898

9999
join = new Join();
100100
join.from = from;
@@ -109,7 +109,7 @@ public Builder(String fieldname) {
109109
* @return completed {@link Join}
110110
*/
111111
public Join to(Field to) {
112-
Assert.notNull(to);
112+
Assert.notNull(to, "To must not be null!");
113113

114114
join.to = to;
115115
return this.join;

src/main/java/org/springframework/data/solr/core/query/ParameterHolder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2013 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public <S> S getParameterValue(String parameterName) {
4848
* @param queryParameter must not be null
4949
*/
5050
public void add(T queryParameter) {
51-
Assert.notNull(queryParameter);
51+
Assert.notNull(queryParameter, "QueryParameter must not be null!");
5252
this.parameters.put(queryParameter.getName(), queryParameter);
5353
}
5454

src/main/java/org/springframework/data/solr/core/query/QueryParameterImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2013 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ public class QueryParameterImpl implements QueryParameter {
3333
*/
3434
public QueryParameterImpl(String name, Object value) {
3535
super();
36-
Assert.notNull(name);
36+
Assert.notNull(name, "Name must not be null!");
3737

3838
this.name = name;
3939
this.value = value;

src/main/java/org/springframework/data/solr/core/query/SimpleQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2016 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -174,7 +174,7 @@ public final <T extends Query> T addProjectionOnFields(String... fieldnames) {
174174

175175
@Override
176176
public final <T extends Query> T setPageRequest(Pageable pageable) {
177-
Assert.notNull(pageable);
177+
Assert.notNull(pageable, "Pageable must not be null!");
178178

179179
this.offset = pageable.getOffset();
180180
this.rows = pageable.getPageSize();

src/main/java/org/springframework/data/solr/core/query/result/HighlightEntry.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 - 2013 the original author or authors.
2+
* Copyright 2012 - 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class HighlightEntry<T> {
3737
* @param entity must not be null
3838
*/
3939
public HighlightEntry(T entity) {
40-
Assert.notNull(entity);
40+
Assert.notNull(entity, "Entity must not be null!");
4141
this.entity = entity;
4242
}
4343

@@ -88,7 +88,7 @@ public static class Highlight {
8888
* @param snipplets
8989
*/
9090
Highlight(Field field, List<String> snipplets) {
91-
Assert.notNull(field);
91+
Assert.notNull(field, "Field must not be null!");
9292

9393
this.field = field;
9494
this.snipplets = snipplets;

0 commit comments

Comments
 (0)