diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java index d1448ab00..f320d8bcf 100644 --- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java +++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2017 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. @@ -73,9 +73,9 @@ public class ClusterCommandExecutor implements DisposableBean { public ClusterCommandExecutor(ClusterTopologyProvider topologyProvider, ClusterNodeResourceProvider resourceProvider, ExceptionTranslationStrategy exceptionTranslation) { - Assert.notNull(topologyProvider); - Assert.notNull(resourceProvider); - Assert.notNull(exceptionTranslation); + Assert.notNull(topologyProvider, "ClusterTopologyProvider must not be null!"); + Assert.notNull(resourceProvider, "ClusterNodeResourceProvider must not be null!"); + Assert.notNull(exceptionTranslation, "ExceptionTranslationStrategy must not be null!"); this.topologyProvider = topologyProvider; this.resourceProvider = resourceProvider; diff --git a/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java index 9e7fcb49b..e9f22fa2c 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-2017 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. @@ -158,7 +158,7 @@ public class RedisSentinelConfiguration { */ public void setMaster(NamedNode master) { - notNull("Sentinel master node must not be 'null'."); + notNull(master, "Sentinel master node must not be 'null'."); this.master = master; } diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java index 03dc6948c..e6e614ff0 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2017 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. @@ -607,7 +607,7 @@ public class JedisClusterConnection implements RedisClusterConnection { @Override public List mGet(byte[]... keys) { - Assert.noNullElements(keys); + Assert.noNullElements(keys, "Keys must not contain null elements!"); if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) { return cluster.mget(keys); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java index 3c99800d7..0799ab8f5 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 the original author or authors. + * Copyright 2011-2017 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. @@ -287,7 +287,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, */ protected JedisCluster createCluster(RedisClusterConfiguration clusterConfig, GenericObjectPoolConfig poolConfig) { - Assert.notNull("Cluster configuration must not be null!"); + Assert.notNull(clusterConfig, "Cluster configuration must not be null!"); Set hostAndPort = new HashSet(); for (RedisNode node : clusterConfig.getClusterNodes()) { @@ -610,7 +610,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, private Jedis getActiveSentinel() { - Assert.notNull(this.sentinelConfig); + Assert.notNull(this.sentinelConfig, "SentinelConfig must not be null!"); for (RedisNode node : this.sentinelConfig.getSentinels()) { diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java index 73e009f4c..3ca3774fb 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2017 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. @@ -334,7 +334,7 @@ abstract public class JedisConverters extends Converters { } public static LIST_POSITION toListPosition(Position source) { - Assert.notNull("list positions are mandatory"); + Assert.notNull(source, "list positions are mandatory"); return (Position.AFTER.equals(source) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE); } diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java index 54d9f092b..2f4820919 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2017 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. @@ -216,7 +216,7 @@ public abstract class JedisUtils { } static LIST_POSITION convertPosition(Position where) { - Assert.notNull("list positions are mandatory"); + Assert.notNull(where, "list positions are mandatory"); return (Position.AFTER.equals(where) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java index 240d7943c..293d624ed 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2017 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. @@ -462,7 +462,7 @@ abstract public class LettuceConverters extends Converters { } public static boolean toBoolean(Position where) { - Assert.notNull("list positions are mandatory"); + Assert.notNull(where, "list positions are mandatory"); return (Position.AFTER.equals(where) ? false : true); } diff --git a/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java index 45169661c..9fe074689 100644 --- a/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java +++ b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2017 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. @@ -52,7 +52,7 @@ public abstract class AbstractSubscription implements Subscription { * @param patterns */ protected AbstractSubscription(MessageListener listener, byte[][] channels, byte[][] patterns) { - Assert.notNull(listener); + Assert.notNull(listener, "MessageListener must not be null!"); this.listener = listener; synchronized (this.channels) { diff --git a/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java b/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java index d485ee6d9..b3341e8bf 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java +++ b/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 the original author or authors. + * Copyright 2011-2017 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. @@ -79,7 +79,7 @@ public class CustomConversions { */ public CustomConversions(List converters) { - Assert.notNull(converters); + Assert.notNull(converters,"Converters must not be null!"); this.readingPairs = new LinkedHashSet(); this.writingPairs = new LinkedHashSet(); @@ -344,8 +344,8 @@ public class CustomConversions { private static Class getCustomTarget(Class sourceType, Class requestedTargetType, Collection pairs) { - Assert.notNull(sourceType); - Assert.notNull(pairs); + Assert.notNull(sourceType, "SourceType must not be null!"); + Assert.notNull(pairs, "Convertible pairs must not be null!"); if (requestedTargetType != null && pairs.contains(new ConvertiblePair(sourceType, requestedTargetType))) { return requestedTargetType; @@ -411,7 +411,7 @@ public class CustomConversions { */ public ConverterRegistration(ConvertiblePair convertiblePair, boolean isReading, boolean isWriting) { - Assert.notNull(convertiblePair); + Assert.notNull(convertiblePair, "Convertible pair must not be null!"); this.convertiblePair = convertiblePair; this.reading = isReading; diff --git a/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java b/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java index f0f8b3bfa..02d6cf06b 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java +++ b/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2017 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. @@ -112,7 +112,7 @@ public class KeyspaceConfiguration { */ public void addKeyspaceSettings(KeyspaceSettings keyspaceSettings) { - Assert.notNull(keyspaceSettings); + Assert.notNull(keyspaceSettings, "KeyspaceSettings must not be null!"); this.settingsMap.put(keyspaceSettings.getType(), keyspaceSettings); } diff --git a/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java index e4240de70..c5f48193d 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java +++ b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. @@ -42,7 +42,7 @@ public class ReferenceResolverImpl implements ReferenceResolver { */ public ReferenceResolverImpl(RedisOperations redisOperations) { - Assert.notNull(redisOperations); + Assert.notNull(redisOperations, "RedisOperations must not be null!"); this.redisOps = redisOperations; this.converter = new StringToBytesConverter(); diff --git a/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java b/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java index 1507fed61..0e1b4cada 100644 --- a/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java +++ b/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2017 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. @@ -86,7 +86,7 @@ public class BasicRedisPersistentEntity extends BasicKeyValuePersistentEntity protected KeyValuePersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNull( KeyValuePersistentProperty property) { - Assert.notNull(property); + Assert.notNull(property, "Property must not be null!"); if (!property.isIdProperty()) { return null; diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java index 6edb0fbe9..9c9a630d8 100644 --- a/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java +++ b/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. @@ -43,6 +43,7 @@ import org.springframework.util.StringUtils; * Base class for {@link Bean} wrappers. * * @author Mark Paluch + * @author Christoph Strobl */ public abstract class CdiBean implements Bean, PassivationCapable { @@ -76,10 +77,10 @@ public abstract class CdiBean implements Bean, PassivationCapable { */ public CdiBean(Set qualifiers, Set types, Class beanClass, BeanManager beanManager) { - Assert.notNull(qualifiers); - Assert.notNull(beanManager); - Assert.notNull(types); - Assert.notNull(beanClass); + Assert.notNull(qualifiers, "Qualifier annotations must not be null!"); + Assert.notNull(beanManager, "BeanManager must not be null!"); + Assert.notNull(types, "Types must not be null!"); + Assert.notNull(beanClass, "Bean class mast not be null!"); this.qualifiers = qualifiers; this.types = types; diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java index 75b761cbe..534212eac 100644 --- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java +++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. @@ -35,6 +35,7 @@ import org.springframework.util.Assert; * {@link CdiBean} to create {@link RedisKeyValueAdapter} instances. * * @author Mark Paluch + * @author Christoph Strobl */ public class RedisKeyValueAdapterBean extends CdiBean { @@ -45,14 +46,13 @@ public class RedisKeyValueAdapterBean extends CdiBean { * * @param redisOperations must not be {@literal null}. * @param qualifiers must not be {@literal null}. - * @param repositoryType must not be {@literal null}. * @param beanManager must not be {@literal null}. */ public RedisKeyValueAdapterBean(Bean> redisOperations, Set qualifiers, BeanManager beanManager) { super(qualifiers, RedisKeyValueAdapter.class, beanManager); - Assert.notNull(redisOperations); + Assert.notNull(redisOperations, "RedisOperations Bean must not be null!"); this.redisOperations = redisOperations; } diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java index ac8159985..5e932b15e 100644 --- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java +++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. @@ -34,6 +34,7 @@ import org.springframework.util.Assert; * {@link CdiBean} to create {@link RedisKeyValueTemplate} instances. * * @author Mark Paluch + * @author Christoph Strobl */ public class RedisKeyValueTemplateBean extends CdiBean { @@ -50,7 +51,7 @@ public class RedisKeyValueTemplateBean extends CdiBean { BeanManager beanManager) { super(qualifiers, KeyValueOperations.class, beanManager); - Assert.notNull(keyValueAdapter); + Assert.notNull(keyValueAdapter, "KeyValueAdapter bean must not be null!"); this.keyValueAdapter = keyValueAdapter; } diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java index 34ce96359..b805ca068 100644 --- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java +++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. @@ -34,6 +34,7 @@ import org.springframework.util.Assert; * {@link CdiRepositoryBean} to create Redis repository instances. * * @author Mark Paluch + * @author Christoph Strobl */ public class RedisRepositoryBean extends CdiRepositoryBean { @@ -53,7 +54,7 @@ public class RedisRepositoryBean extends CdiRepositoryBean { Class repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) { super(qualifiers, repositoryType, beanManager, detector); - Assert.notNull(keyValueTemplate); + Assert.notNull(keyValueTemplate, "Bean holding keyvalue template must not be null!"); this.keyValueTemplate = keyValueTemplate; } diff --git a/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java b/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java index 067ed077c..666d53331 100644 --- a/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java +++ b/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2017 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. @@ -33,6 +33,7 @@ import org.springframework.util.Assert; * bean. Note: Does not handle nulls in any special way delegating everything to the container. * * @author Costin Leau + * @author Christoph Strobl */ public class GenericToStringSerializer implements RedisSerializer, BeanFactoryAware { @@ -45,7 +46,7 @@ public class GenericToStringSerializer implements RedisSerializer, BeanFac } public GenericToStringSerializer(Class type, Charset charset) { - Assert.notNull(type); + Assert.notNull(type, "tyoe must not be null!"); this.type = type; this.charset = charset; } diff --git a/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java index a0071ffef..e7fde0c23 100644 --- a/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java +++ b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 the original author or authors. + * Copyright 2011-2017 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. @@ -30,6 +30,7 @@ import org.springframework.util.Assert; * @author Mark Pollack * @author Costin Leau * @author Mark Paluch + * @author Christoph Strobl */ public class JdkSerializationRedisSerializer implements RedisSerializer { @@ -63,8 +64,8 @@ public class JdkSerializationRedisSerializer implements RedisSerializer */ public JdkSerializationRedisSerializer(Converter serializer, Converter deserializer) { - Assert.notNull("Serializer must not be null!"); - Assert.notNull("Deserializer must not be null!"); + Assert.notNull(serializer, "Serializer must not be null!"); + Assert.notNull(deserializer, "Deserializer must not be null!"); this.serializer = serializer; this.deserializer = deserializer; diff --git a/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java index 14a24562d..5aa898840 100644 --- a/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java +++ b/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2017 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. @@ -28,6 +28,7 @@ import org.springframework.util.Assert; * Does not perform any null conversion since empty strings are valid keys/values. * * @author Costin Leau + * @author Christoph Strobl */ public class StringRedisSerializer implements RedisSerializer { @@ -38,7 +39,7 @@ public class StringRedisSerializer implements RedisSerializer { } public StringRedisSerializer(Charset charset) { - Assert.notNull(charset); + Assert.notNull(charset, "Charset must not be null!"); this.charset = charset; }