• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Exception not propagated on "input to long"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Exception not propagated on "input to long"
      • From: George Domurot <email@hidden>
  • Prev by Date: Re: [SOLVED]: Compiled app from Mac to Windows
  • Next by Date: [ANN] woproject 1.1.0.102 RC 2
  • Previous by thread: Re: [SOLVED]: Compiled app from Mac to Windows
  • Next by thread: Re: Exception not propagated on "input to long"
  • Index(es):
    • Date
    • Thread