Validation exceptions
Validation exceptions
- Subject: Validation exceptions
- From: Ed Powell <email@hidden>
- Date: Sun, 5 Jan 2003 05:25:25 -0600 (CST)
This is really annoying me, as it was working just fine before, and all
the sudden, its not.
I have a custom EO object class:
import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import java.math.BigDecimal;
import java.util.*;
public class Users extendes EOGenericRecord {
I have a private method to handle generic String validation, and if there
is invalid data, it throws an NSValidation.ValidationException, otherwise
it returns the string. 'property' is the name of the property being
checked (I need it for determining the correct exception string), 'data'
is the string to be validated, and trimIt is used to indicate that
data.trim() should be run:
private String masterStringValidator(String property, String data, boolean
trimIt) throws NSValidation.ValidationException {
Now, where the actual validation happens I have this (for example):
public String validateVerifyq(String newVerifyq)
throws NSValidation.ValidationException {
String validatedVerifyq = new
String(masterStringValidator("Verifyq",newVerifyq,true));
return validatedVerifyq;
}
My understanding of exceptions is that you either need to try/catch
exceptions where they may occur, or define in the method's constructor
that it will be throwing the exception, and it gets handled 'up the
chain'.
The problem I'm having these days is that when I try building/running my
project, and get to the part where it does validation, Webobjects is
returning the error as if its unhandled, with the ugly error messages and
everything, when validateVerifyq runs the masterStringValidator. The
exception that masterStringValidator is generating (which is correct),
should be thrown up the line to the component that called it, and caught
and handled by the validationFailedWithException method. Yet, its not.
Its just dying inside of the masterStringValidator method when it does
'throw new NSValidation.ValidationException(...);', instead of getting
passed on...
Help. I'm going nuts over this.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.