Fixed - Spring Data Redis RedissonConnection.execute() method doesn't invoke overloaded methods correctly. #4155

pull/4226/head
Nikita Koksharov 3 years ago
parent 57b1577df8
commit 0a8547ce06

@ -160,7 +160,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -179,7 +179,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -182,7 +182,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -164,7 +164,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -157,7 +157,9 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public Object execute(String command, byte[]... args) {
for (Method method : this.getClass().getDeclaredMethods()) {
if (method.getName().equalsIgnoreCase(command) && Modifier.isPublic(method.getModifiers())) {
if (method.getName().equalsIgnoreCase(command)
&& Modifier.isPublic(method.getModifiers())
&& (method.getParameterTypes().length == args.length)) {
try {
Object t = execute(method, args);
if (t instanceof String) {

@ -19,6 +19,13 @@ import java.util.Set;
public class RedissonConnectionTest extends BaseConnectionTest {
@Test
public void testExecute() {
Long s = (Long) connection.execute("ttl", "key".getBytes());
assertThat(s).isEqualTo(-2);
connection.execute("flushDb");
}
@Test
public void testRandomMembers() {
RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<>();

Loading…
Cancel
Save