Re: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
Re: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
- Subject: Re: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
- From: Kieran Kelleher <email@hidden>
- Date: Sat, 18 Jun 2005 07:26:44 -0400
David, yes, it is my problem (my head is clearer now this morning!)
The stack trace below indicates that the exception is initially being
thrown
at
com.webobjects.eoaccess.EOAttribute.validateValue(EOAttribute.java:
2371).
OK, here is the situation: I have a custom immutable class,
EncodedString, that is used as a custom attribute. It is constructed
with a string and it's converion method encrypts the string for writing
to the database while the factory method takes an encrypted string and
decrypts it and creates an instance of EncodedString. The custom class
has one significant iVar and that is _decodedValue.
I designed the class to handle nulls so that when a null is in the DB,
the factory method creates an instance having its _decodedValue equal
to null. In that case the conversion method returns null. In my
WOComponent that handles this custom type, I am setting the custom
attribute as a new instance with _decodedValue equal to null when the
user submits and empty/null String. Should my approach to null handling
be different?
Would it be of use to post the code for my custom class?
Regards, Kieran (PS. I've switched this conversation to the main WO-Dev
thread since it is not a Wonder problem)
------------------------------------------------------------------------
------------------------------------------------------------------------
--------
401741 ERROR [WorkerThread2] (er.extensions.ERXApplication,
reportException, 484) -
Exception caught: Undefined validation template for entity
"CTCcInformation" property "numberEncrypted" type
"ValueConversionException" target language "Nonlocalized"
Extra info: {CurrentPage = "AccountPage"; CurrentComponentHierarchy =
("ButtonBar", "AccountPage"); CurrentComponent = "ButtonBar";
PreviousPageList = ("Main", "Customers",
"er.extensions.ERXLog4JConfiguration",
"er.extensions.ERXLog4JConfiguration", "CustomerPage", "AccountPage",
"AccountPage", "AccountPage", "er.extensions.ERXLog4JConfiguration",
"er.extensions.ERXLog4JConfiguration"); uri =
"/cgi-bin/WebObjects/cheetah.woa/-52040/wo/5ypG7HEPedHwztXAxGAkjM/
9.0.7.3.0.0"; }
<er.extensions.ERXValidationException object: <CTCcInformation
pk:"null">; propertyKey: numberEncrypted; type:
ValueConversionException; additionalExceptions: ()>
at
com.webobjects.eoaccess.EOAttribute.validateValue(EOAttribute.java:
2371)
at
com.webobjects.eoaccess.EOEntityClassDescription.validateValueForKey(EOE
ntityClassDescription.java:439)
at
er.extensions.ERXEntityClassDescription.validateValueForKey(ERXEntityCla
ssDescription.java:726)
at
com.webobjects.eocontrol.EOCustomObject.validateValueForKey(EOCustomObje
ct.java:1339)
at
er.extensions.ERXGenericRecord.validateValueForKey(ERXGenericRecord.java
:775)
..... etc., etc.
___________________________________
Kieran Kelleher
Palm Harbor, Florida USA
On Jun 17, 2005, at 10:49 AM, David Teran wrote:
The code is OK. Please send the whole stacktrace and the whole error
message.
thanks David
On 17.06.2005, at 16:11, Kieran Kelleher wrote:
I have a custom class that I am using as an EO attribute. I have no
UserInfo dictionaries in any EO's. I use validateKey methods in my
code. I have these properties in Properties file
er.extensions.ERXGenericRecord.useValidity = false
er.extensions.ERXCustomObject.useValidity = false
However I get this message if I DON'T have a custom validateKey
method in my ERXGenericRecord subclass:
Undefined validation template for entity "CTCcInformation" property
"numberEncrypted" type "ValueConversionException" target language
"Nonlocalized"
Looking at the source code for ERXGenericRecord, and the
validateValueForKey method, should there be an if { } block to check
for useValidity() like this instead of calling
validateObjectsWithUserInfo on ERXEntityClassDescription?
if ( useValidity() ) {
EOClassDescription cd = classDescription();
if(cd instanceof ERXEntityClassDescription) {
((ERXEntityClassDescription)cd).validateObjectWithUserInfo(this,
value, "validateForKey." + key, key);
}
}
If this should be the case, can a committer please update the source?
If not, then what concept am I misunderstanding?
Regards, Kieran
_______________________________________________
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