From b6d124f6ca4a55f94ca4c89bf00b5e38a49dd326 Mon Sep 17 00:00:00 2001 From: jackygurui Date: Fri, 10 Jun 2016 01:46:08 +0100 Subject: [PATCH] Prefers no arg constructor --- .../java/org/redisson/RedissonAttachedLiveObjectService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/redisson/RedissonAttachedLiveObjectService.java b/src/main/java/org/redisson/RedissonAttachedLiveObjectService.java index b3c68d8f9..9fa3bb247 100644 --- a/src/main/java/org/redisson/RedissonAttachedLiveObjectService.java +++ b/src/main/java/org/redisson/RedissonAttachedLiveObjectService.java @@ -1,6 +1,5 @@ package org.redisson; -import java.lang.reflect.Constructor; import java.util.Map; import java.util.concurrent.TimeUnit; import net.bytebuddy.ByteBuddy; @@ -57,9 +56,9 @@ public class RedissonAttachedLiveObjectService implements RAttachedLiveObjectSer try { T instance; try { - instance = getProxyClass(entityClass).getDeclaredConstructor(id.getClass()).newInstance(id); - } catch (NoSuchMethodException exception) { instance = getProxyClass(entityClass).newInstance(); + } catch (Exception exception) { + instance = getProxyClass(entityClass).getDeclaredConstructor(id.getClass()).newInstance(id); } ((RLiveObject) instance).setLiveObjectId(id); return instance;