This is an automated email from the ASF dual-hosted git repository.

doebele pushed a commit to branch version3
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/version3 by this push:
     new f7c82ad  EMPIREDB-368 small fix
f7c82ad is described below

commit f7c82ad361006160a64ecbab16cce993a0365b9c
Author: Rainer Döbele <[email protected]>
AuthorDate: Thu Feb 3 21:55:56 2022 +0100

    EMPIREDB-368 small fix
---
 empire-db/src/main/java/org/apache/empire/commons/ClassUtils.java    | 2 +-
 .../main/java/org/apache/empire/db/list/DBBeanListFactoryImpl.java   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/empire-db/src/main/java/org/apache/empire/commons/ClassUtils.java 
b/empire-db/src/main/java/org/apache/empire/commons/ClassUtils.java
index 6d79ca5..866ff52 100644
--- a/empire-db/src/main/java/org/apache/empire/commons/ClassUtils.java
+++ b/empire-db/src/main/java/org/apache/empire/commons/ClassUtils.java
@@ -188,7 +188,7 @@ public final class ClassUtils
     public static Constructor<?> findMatchingAccessibleConstructor(Class<?> 
clazz, Class<?>[] parameterTypes)
     {
         // search through all constructors 
-        int paramSize = parameterTypes.length;
+        int paramSize = (parameterTypes!=null ? parameterTypes.length : 0);
         Constructor<?>[] ctors = clazz.getConstructors();
         for (int i = 0, size = ctors.length; i < size; i++)
         {   // compare parameters
diff --git 
a/empire-db/src/main/java/org/apache/empire/db/list/DBBeanListFactoryImpl.java 
b/empire-db/src/main/java/org/apache/empire/db/list/DBBeanListFactoryImpl.java
index ba87736..7da7872 100644
--- 
a/empire-db/src/main/java/org/apache/empire/db/list/DBBeanListFactoryImpl.java
+++ 
b/empire-db/src/main/java/org/apache/empire/db/list/DBBeanListFactoryImpl.java
@@ -64,7 +64,7 @@ public class DBBeanListFactoryImpl<T> implements 
DBBeanListFactory<T>
     @SuppressWarnings("unchecked")
     protected static <T> Constructor<T> findBeanConstructor(Class<T> beanType)
     {   // find default constructor
-        return 
(Constructor<T>)ClassUtils.findMatchingAccessibleConstructor(beanType, new 
Class<?>[] {});
+        return 
(Constructor<T>)ClassUtils.findMatchingAccessibleConstructor(beanType, null);
     }
     
     /*
@@ -121,7 +121,7 @@ public class DBBeanListFactoryImpl<T> implements 
DBBeanListFactory<T>
      * @param keyColumns (optional) the columns to be used for the constructor
      * @param selectColumns (optional) the columns to be set through setter 
methods. List may include constructorParams
      */
-    public DBBeanListFactoryImpl(Class<T> beanType, List<? extends 
DBColumnExpr> keyColumns, List<? extends DBColumnExpr> selectColumns) 
+    protected DBBeanListFactoryImpl(Class<T> beanType, List<? extends 
DBColumnExpr> keyColumns, List<? extends DBColumnExpr> selectColumns) 
     {
         Constructor<T> constructor = findBeanConstructor(beanType, 
selectColumns);
         if (constructor!=null)
@@ -143,6 +143,7 @@ public class DBBeanListFactoryImpl<T> implements 
DBBeanListFactory<T>
             this.constructorParams = null;
             this.setterColumns = selectColumns;
         }
+        // found one
         this.constructor = constructor;
     }
     

Reply via email to