-->
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: InvalidStateException
PostPosted: Wed Oct 10, 2007 7:11 am 
Newbie

Joined: Wed Oct 10, 2007 6:29 am
Posts: 1
Can you please give me your opinion about extending the default error message created by the InvalidStateException? At present in case the validation fails there is no chance to figure out what went wrong. And I can not believe that catching this particular Hibernate-exception in the business layer (see code below) is the right place to retrieve the info. Furthermore it is a runtime exception and thus I believe the exception is responsible for telling the user as much as possible (which might be different for a checked exception, but this is another discussion).

Code:
try {
    myPersistenceLayer.save(myObject);
} catch (org.hibernate.validator.InvalidStateException e) {
    // THE SOURCE OF THE VALIDATON ERROR IS LOST,
    // BECAUSE NOT CONTAINED IN THE toString() OF
    // THE InvalidStateException?
    // just demonstration, no production code :-)
    //
    System.out.println(Arrays.toString(e.getInvalidValues()));
   
    throw e;
}


Maybe the toString() should additionally contain 'Arrays.toString(e.getInvalidValues())'?

Is this a bug or feature request?

Jens
Code:


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.