• 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
SOLVED: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SOLVED: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )


  • Subject: SOLVED: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
  • From: Kieran Kelleher <email@hidden>
  • Date: Sat, 18 Jun 2005 10:50:50 -0400

OK, I've solved it. In brief, do not return a null value from the conversion method of a custom EO attribute class. If the user submits null, then set the attribute to null, not an instance of the custom class that returns a null from the conversion method. Also the factory method should return null instead of creating an instance that wraps null.

Works perfectly now!

David, thanks for the help.

Regards, Kieran

-Kieran
________________________________________________________________
Blog: http://webobjects.webhop.org/


On Jun 18, 2005, at 7:26 AM, Kieran Kelleher wrote:

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(EO EntityClassDescription.java:439)
at er.extensions.ERXEntityClassDescription.validateValueForKey(ERXEntityCl assDescription.java:726)
at com.webobjects.eocontrol.EOCustomObject.validateValueForKey(EOCustomObj ect.java:1339)
at er.extensions.ERXGenericRecord.validateValueForKey(ERXGenericRecord.jav a: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:
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
References: 
 >Re: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? ) (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: create Installer for WebObjects Application
  • Next by Date: XML converting Text-Image in a component
  • Previous by thread: Re: Custom EOAttribute.validateValue ( was: [Wonder-disc] ERXGenericRecord problem? )
  • Next by thread: create Installer for WebObjects Application
  • Index(es):
    • Date
    • Thread