Re: Exception not propagated on "input to long"
Re: Exception not propagated on "input to long"
- Subject: Re: Exception not propagated on "input to long"
- From: George Domurot <email@hidden>
- Date: Wed, 12 Jan 2005 07:56:16 -0800
Take a look at the API reference for
WOComponent.validationFailedWithException
On Jan 12, 2005, at 3:20 AM, Wolfram Stebel wrote:
Hi all,
in the code below, ec.saveChanges () with a input to long for the
database
field does not propagate the exception.
public WOComponent saveTask()
{
try
{
if ( ec.hasChanges () )
{
theTask.setUpdater ( session.getThePerson () );
theTask.setUpd_date ( DateHelper.getNSTimestampForNow
() );
ec.saveChanges ();
}
hasErrors = false;
return returnPage();
}
catch ( NSValidation.ValidationException exception )
{
hasErrors = true;
errors = exception.getMessage ();
}
return null;
}
But the trace shows the exception:
[2005-01-12 12:10:30 CET] <WorkerThread12>
com.webobjects.foundation.NSValidation$ValidationException: The
task_title
property of Task exceeds maximum length of 128 characters
at
com.webobjects.eoaccess.EOAttribute.validateValue(EOAttribute.java:
2381)
at
com.webobjects.eoaccess.EOEntityClassDescription.validateValueForKey(EO
Entit
yClassDescription.java:439)
...
..
.
The data is not saved!
I dont come into the catch branch, i.e. no user feedback!
The problem is, that validateOnSave is called only in ec.saveChanges
(), not
before, so i can not validate the input length.
Calling validateForSave explicit for theTask is not to great of a
solution.
Any clever idea?
Should i just remove the call to hasChanges ()? I thought it is an
performance improvement...
Wolfram Stebel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden