You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2008/12/10 20:40:46 UTC

[jira] Resolved: (WSCOMMONS-182) Infinite loop in OMElement possible

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

Andreas Veithen resolved WSCOMMONS-182.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: Axiom 1.2.8

Fixed SAXOMBuilder so that an exception is thrown in this case.

> 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
>             Fix For: Axiom 1.2.8
>
>         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.