-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Improvement proposal for dynamic instantiation
PostPosted: Thu Feb 04, 2010 7:03 am 
Newbie

Joined: Thu Oct 29, 2009 5:36 am
Posts: 2
Hello,

1. Please make the message "no appropriate constructor in class" of the PropertyNotFoundException inside getConstructor(Class clazz, Type[] types) in class org.hibernate.util.ReflectHelper more expressive. I have found many other posts affected to dynamic instantiation and the correct constructor. I propose you list the expected types in the message like this:

Code:
      StringBuilder msg = new StringBuilder();
      msg.append("no appropriate constructor in class: ")
          .append(clazz.getName())
          .append("\nexpected parameter types: [");
      boolean comma = false;
      for (Type type : types) {
          if (comma) msg.append(", ");
          if (type != null)
              msg.append(type.getReturnedClass().getName());
          else
              msg.append("null");
          comma = true;
      }
      msg.append("]");
      throw new PropertyNotFoundException(msg.toString());


2. The dynamic instantiation runs into a NullPointerException if the underlying sql statement returns null for a column. I guess this is a bug. I'm using JBoss AS 5.1/Hibernate Core 3.3.1.

Cheers Dieter.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.