[ 
https://issues.apache.org/jira/browse/WSCOMMONS-182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Veithen reassigned WSCOMMONS-182:
-----------------------------------------

    Assignee: Andreas Veithen

> Infinite loop in OMElement possible
> -----------------------------------
>
>                 Key: WSCOMMONS-182
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-182
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>         Environment: Windows XP, Java 1.5_09, Axiom 1.1.1.
>            Reporter: Ryan Nelsestuen
>            Assignee: Andreas Veithen
>         Attachments: InfinteLoopDemo.java
>
>
> > I discovered today that under certain circumstances you can create an 
> > OMElementImpl that will go into an infinte loop if you call 
> > getFirstElement();  The specific example I found is if you create an 
> > OMElement via the SAXOMBuilder and pass the SAXOMBuilder and 
> > incomplete/malformed series of events (example code below).  The 
> > workaround is to check isComplete() before calling getFirstElement(), 
> > but it seems like there should be some other way to avoid this condition.
> >
> package axiomtest;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.impl.builder.SAXOMBuilder;
> import org.xml.sax.Attributes;
> public class InfinteLoopDemo {
>     public static void main(String[] args) throws Exception{
>         
>         SAXOMBuilder builder = new SAXOMBuilder();
>         
>         //builder.startPrefixMapping("test", "http://test.com";);
>         builder.startDocument();
>         builder.startElement("http://test.com";, "test", 
> "test:http://test.com";, new Attributes(){
>             public int getIndex(String uri, String localName) {
>                 // TODO Auto-generated method stub
>                 return 0;
>             }
>             public int getIndex(String qName) {
>                 // TODO Auto-generated method stub
>                 return 0;
>             }
>             public int getLength() {
>                 // TODO Auto-generated method stub
>                 return 0;
>             }
>             public String getLocalName(int index) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getQName(int index) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getType(int index) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getType(String uri, String localName) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getType(String qName) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getURI(int index) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getValue(int index) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getValue(String uri, String localName) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             public String getValue(String qName) {
>                 // TODO Auto-generated method stub
>                 return null;
>             }
>             
>         });
>         OMElement root = builder.getRootElement();
>         OMElement firstChild = root.getFirstElement();
>         System.out.println("First child is: " + firstChild);
>         
>     }
>     
>     
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to