[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-17 Thread Keith Visco
Hi Jene,
Thanks for the patches and test cases. I appreciate the effort you spent 
on looking into this issue.

It would be much better for everyone, however, if you could attach these 
directly to bug 1723 instead of using the mailing list. It allows us to 
track the bug progress in a single place. Keeping track of the patches 
and progress is much easier if everything is kept together in bugzilla. 
It also helps to keep bandwidth down on the mailing lists.

So if you can attach the patches to directly to bug 1723 that would be 
great and then I'll look at them as soon as I can.

Thanks a lot,
--Keith
Most of the people on this list don't
Jene Jasper wrote:
Keith,
To get validation working correctly for an UnmarhalHandler, that 
supports xsi:nil, I have created the attached 
TestCaseBug1723Unmarshaller. The used classes are generated based on the 
attached bug1723.xsd. The asserts and fails that don't work as expected 
are commented out. For some ValidationException a wrong reason is 
creating the correct behavior in which case I have added a temporary 
alternative assert. Could you take a look if my validation assumptions 
are correct ?

To get the validation correct for the above asserts and fails the 
Validator needs to have some notion if  the tag was supplied  (for 
example ...Tag/) or supplied and has attribute xsi:nil set (for 
example ...Tag xsi::nil=true/) or if the tag wasn't there. In other 
words handle ...Tag/ and ...Tag xsi::nil=true/ as field is null 
and fieldNilOption is true (Note: exception is StringTag/ which has 
field =  and nilOption is false). When the tag is missing handle it as 
field is null and field nilOption is false. Or should ...Tag/ as if 
...Tag xsi::nil=false/ and thus throw required field exception with 
StringTag/ still the only exception. In the latter case some of my 
validation assumptions aren't correct (and even a hasFieldOption might 
be necessary) !

An example of a generated class that could be used for this purpose is 
the attached TopValidationTag with nilOptions: private boolean 
_nil_requiredNillableDateTag and private java.util.ArrayList 
_nilRequiredMultipleDateTag.

To set those nilOptions I would like to add a new method public void 
setValue( java.lang.Object object, java.lang.Object value, boolean nil) 
to XMLFieldHandler. But the UnmarhalHandler makes use of  the 
FieldHandler. Should I move it to FieldHandler or create a helpermethod 
in UnmarhalHandler for all  handler.setValue calls that checks if the 
handler is an instanceof XMLFieldHandler and then call the new method 
because in the end all handler that are encountered are XMLFieldHandler 
anyway ?

Thanks,
Jene

--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
   unsubscribe castor-dev


Re: [castor-dev] Castor 0.9.6-RC3 lazy loading net.sf.cglib.core.CodeGenerationException

2005-01-17 Thread Werner Guttmann

Thanks, Jon. For any updates, please watch the bug report.

Regards
Werner

On Sun, 16 Jan 2005 16:51:25 -0800 (PST), Jon Wilmoth wrote:


Done...It's
http://bugzilla.exolab.org/show_bug.cgi?id=1855

--- Werner Guttmann [EMAIL PROTECTED] wrote:

 
 Jon,
 
 can you please file a bug report at
 http://bugzilla.exolab.org, and I'll look into this
 issue tomorrow. Actually, I have not changed lazy
 loading for 
 collections, but only introduced support for lazy
 loading for 1:1 relations. But it looks to me like
 Castor is getting confused a bug about where to
 apply 
 which method.
 
 Thanks
 Werner
 
 On Sat, 15 Jan 2005 18:23:40 -0800 (PST), Jon
 Wilmoth wrote:
 
 
 It looks like the lazy loading has changed in 0.9.6
 from 0.9.5.3. I'm getting an reflection based
 exception trying to load a class that has a
 property
 who in turn has a lazy loaded collection.  The lazy
 loaded property on the Project class has the
 following
 mapping/java declaration:
 
 //marked transient since the castor persistent
 collection is not serializeable
 protected transient Collection phases = new
 ArrayList();
 
 field name=phases
 type=com.apex.chronos.app.project.Phase
 lazy=true
 collection=collection
   sql many-key=PROJECT_ID/
   bind-xml name=phases node=element
 transient=false/
 /field
 
 What do I need to do to get lazy loading working in
 this release?
 
 Thanks,
 Jon
 
 
 Jan-15-2005 5:56:56:020 PM, PST [ERROR]
 (org.exolab.castor.persist.SingleProxy:?) -- error
 on
 enhance class com.apex.chronos.app.project.Project
 net.sf.cglib.core.CodeGenerationException:
 java.lang.IllegalAccessException--Class
 org.exolab.castor.persist.SingleProxy can not
 access a
 member of class
 com.apex.chronos.app.project.BasicProject with
 modifiers protected
 at

net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
 at

net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
 at

net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
 at

net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:566)
 at

net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:493)
 at

net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220)
 at

net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
 at

net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
 at

net.sf.cglib.proxy.Enhancer.create(Enhancer.java:597)
 at

org.exolab.castor.persist.SingleProxy.getProxy(ClassMolder.java:3243)
 at

org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:776)
 at

org.exolab.castor.persist.LockEngine.load(LockEngine.java:361)
 at

org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:698)
 at

org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
 at

org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:602)
 at

org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:585)
 at

com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:841)
 at

com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:817)
 at

com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:809)
 at

com.apex.chronos.app.authorization.ProjectRoleAssignment.findByPersonIdAndProjectId(ProjectRoleAssignment.java:121)
 at

com.apex.chronos.app.authorization.AuthorizationGuard.getProjectRoleAssignments(AuthorizationGuard.java:332)
 at

com.apex.chronos.app.authorization.AuthorizationGuard.getActiveProjectRoleAssignments(AuthorizationGuard.java:347)
 at

com.apex.chronos.app.authorization.AuthorizationGuard.hasProjectAuthorization(AuthorizationGuard.java:701)
 at

com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorized(AuthorizationGuard.java:125)
 at

com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorizedToView(AuthorizationGuard.java:74)
 at

com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:900)
 at

com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:880)
 at

com.apex.chronos.app.project.BasicProject.findByPrimaryKey(BasicProject.java:216)
 at

com.apex.chronos.ui.integration.ExportTimeSheetAction.constructExportableTimeSheet(ExportTimeSheetAction.java:281)
 at

com.apex.chronos.ui.integration.ExportTimeSheetAction.exportToQBOE(ExportTimeSheetAction.java:158)
 at

com.apex.chronos.ui.integration.ExportTimeSheetAction.doPerform(ExportTimeSheetAction.java:78)
 at

com.apex.chronos.ui.AbstractAction.execute(AbstractAction.java:161)
 
 
 

---
 
 If you wish to unsubscribe from this mailing, send
 mail to
 [EMAIL PROTECTED] with a subject of:
 unsubscribe castor-dev
 
 
 
 

---
 
 If