Exception not propagated on "input to long"
Exception not propagated on "input to long"
- Subject: Exception not propagated on "input to long"
- From: Wolfram Stebel <email@hidden>
- Date: Wed, 12 Jan 2005 12:20:50 +0100
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(EOEntit
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:
This email sent to email@hidden