2323import java .util .*;
2424import java .util .concurrent .TimeUnit ;
2525import java .util .function .BiPredicate ;
26- import java .util .function .Supplier ;
2726import java .util .stream .Collectors ;
2827import java .util .stream .Stream ;
2928
3029import org .apache .commons .logging .Log ;
3130import org .apache .commons .logging .LogFactory ;
3231import org .bson .Document ;
3332import org .bson .conversions .Bson ;
33+
3434import org .springframework .beans .BeansException ;
3535import org .springframework .context .ApplicationContext ;
3636import org .springframework .context .ApplicationContextAware ;
@@ -1870,21 +1870,21 @@ public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputColle
18701870
18711871 @ Override
18721872 public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , Class <O > outputType ) {
1873+
1874+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
18731875 return aggregate (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
18741876 }
18751877
18761878 @ Override
18771879 public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , String inputCollectionName ,
18781880 Class <O > outputType ) {
1879-
1880- Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1881-
18821881 return aggregate (aggregation , inputCollectionName , outputType , null );
18831882 }
18841883
18851884 @ Override
18861885 public <O > AggregationResults <O > aggregate (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
18871886
1887+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
18881888 return aggregate (aggregation , getCollectionName (inputType ), outputType ,
18891889 queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
18901890 }
@@ -1897,19 +1897,20 @@ public <O> AggregationResults<O> aggregate(Aggregation aggregation, String colle
18971897 @ Override
18981898 public <O > Stream <O > aggregateStream (TypedAggregation <?> aggregation , String inputCollectionName ,
18991899 Class <O > outputType ) {
1900-
1901- Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
19021900 return aggregateStream (aggregation , inputCollectionName , outputType , null );
19031901 }
19041902
19051903 @ Override
19061904 public <O > Stream <O > aggregateStream (TypedAggregation <?> aggregation , Class <O > outputType ) {
1905+
1906+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
19071907 return aggregateStream (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
19081908 }
19091909
19101910 @ Override
19111911 public <O > Stream <O > aggregateStream (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
19121912
1913+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
19131914 return aggregateStream (aggregation , getCollectionName (inputType ), outputType ,
19141915 queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
19151916 }
@@ -2056,8 +2057,8 @@ protected <O> AggregationResults<O> doAggregate(Aggregation aggregation, String
20562057 protected <O > Stream <O > aggregateStream (Aggregation aggregation , String collectionName , Class <O > outputType ,
20572058 @ Nullable AggregationOperationContext context ) {
20582059
2059- Assert .hasText (collectionName , "Collection name must not be null or empty" );
20602060 Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2061+ Assert .hasText (collectionName , "Collection name must not be null or empty" );
20612062 Assert .notNull (outputType , "Output type must not be null" );
20622063 Assert .isTrue (!aggregation .getOptions ().isExplain (), "Can't use explain option with streaming" );
20632064
0 commit comments