exceptions caused by duplicate id's

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

exceptions caused by duplicate id's

Adrian Baker-2
Should OPS validate and report errors when there are duplicate id's in
the input document? Or is this too expensive?

If not, the type of the return value of
containingDocument.getObjectById(..) should be checked before casting -
I just got a hard-to-debug ClassCastException when I made the mistake of
generating a document containing a <xforms:group> that had the same id
as a <xforms:instance>:

java.lang.ClassCastException
    at
org.orbeon.oxf.xforms.processor.handlers.XFormsGroupHandler.start(XFormsGroupHandler.java:44)
    at
org.orbeon.oxf.xml.ElementHandlerController.startElement(ElementHandlerController.java:145)
    at org.orbeon.oxf.xml.SAXStore.replay(SAXStore.java:162)
    at
org.orbeon.oxf.xforms.processor.XFormsToXHTML.outputResponse(XFormsToXHTML.java:498)
    at
org.orbeon.oxf.xforms.processor.XFormsToXHTML.doIt(XFormsToXHTML.java:220)

(the returned value was being cast to ControlInfo when in fact it was a
XFormsInstance).

Even with a type check though, all sorts of things obscure errors could
still arise if you gave input controls the same id...

Adrian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: exceptions caused by duplicate id's

Erik Bruchez
Administrator
Adrian Baker wrote:
> Should OPS validate and report errors when there are duplicate id's in
> the input document? Or is this too expensive?

We already detected duplicate ids for controls. I have now added code to
detect this globally.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws