You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Eric Johnson (JIRA)" <ji...@apache.org> on 2005/09/24 00:04:28 UTC

[jira] Created: (AXIS2-241) AXIOM exposes interface functions that should be implementation details

AXIOM exposes interface functions that should be implementation details
-----------------------------------------------------------------------

         Key: AXIS2-241
         URL: http://issues.apache.org/jira/browse/AXIS2-241
     Project: Apache Axis 2.0 (Axis2)
        Type: Improvement
  Components: om  
    Versions: 0.91    
    Reporter: Eric Johnson


The OMNode interface includes functions like:
    public void setNextSibling(OMNode node);
    public void setPreviousSibling(OMNode previousSibling);
    public void setParent(OMContainer element);
    public void setComplete(boolean state);
    public void setType(int nodeType) throws OMException;

OMContainer includes:
    public void setComplete(boolean state);
    public void setFirstChild(OMNode omNode);

The availability of these functions in the interface means that clients can accidentally or intentionally misbehave and corrupt the data structures.

For example, intentional corruption:

OMNode next = om.getNextSibling();
om.detach();
next.setPreviousSibling(om);

Or the accidental:
OMElement parent = theParent;
OMNode lastChild = parent.getLastChild();
lastChild.setNextSibling(theNewSibling);  // you might reasonably think that this will insert into parent!

Where possible, these functions ought to be defined in a package visible interface particular to the implementation package, so that only the implementation can alter crucial details that affect the integrity of the tree structure.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS2-241) AXIOM exposes interface functions that should be implementation details

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-241?page=all ]
     
Davanum Srinivas resolved AXIS2-241:
------------------------------------

    Resolution: Fixed

Extracted those methods into 2 internal interfaces OMNodeEx and OMContainerEx and typecasted whereever needed. 

> AXIOM exposes interface functions that should be implementation details
> -----------------------------------------------------------------------
>
>          Key: AXIS2-241
>          URL: http://issues.apache.org/jira/browse/AXIS2-241
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Improvement
>   Components: om
>     Versions: 0.91
>     Reporter: Eric Johnson

>
> The OMNode interface includes functions like:
>     public void setNextSibling(OMNode node);
>     public void setPreviousSibling(OMNode previousSibling);
>     public void setParent(OMContainer element);
>     public void setComplete(boolean state);
>     public void setType(int nodeType) throws OMException;
> OMContainer includes:
>     public void setComplete(boolean state);
>     public void setFirstChild(OMNode omNode);
> The availability of these functions in the interface means that clients can accidentally or intentionally misbehave and corrupt the data structures.
> For example, intentional corruption:
> OMNode next = om.getNextSibling();
> om.detach();
> next.setPreviousSibling(om);
> Or the accidental:
> OMElement parent = theParent;
> OMNode lastChild = parent.getLastChild();
> lastChild.setNextSibling(theNewSibling);  // you might reasonably think that this will insert into parent!
> Where possible, these functions ought to be defined in a package visible interface particular to the implementation package, so that only the implementation can alter crucial details that affect the integrity of the tree structure.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-241) AXIOM exposes interface functions that should be implementation details

Posted by "Eric Johnson (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-241?page=comments#action_12330326 ] 

Eric Johnson commented on AXIS2-241:
------------------------------------

OMNode.setParent() is only referenced from within the org.apache.axis2.om.impl.llom package.

I think if you change the impl of OMFactory.createOMElement() methods that take a parent, you can do the "addChild()" in those cases, eliminate the need for the caller to setNextSibling() on the lastSibling, or setPreviousSibling() on the node being added.

Not quite sure what to do about OMNode.setComplete(), as yet.  Just looking at the code for the first time.

OMNode.setType() could be hidden by changing OMFactory.createText(parent, text) --> (parent, text, type), or something like that.



> AXIOM exposes interface functions that should be implementation details
> -----------------------------------------------------------------------
>
>          Key: AXIS2-241
>          URL: http://issues.apache.org/jira/browse/AXIS2-241
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Improvement
>   Components: om
>     Versions: 0.91
>     Reporter: Eric Johnson

>
> The OMNode interface includes functions like:
>     public void setNextSibling(OMNode node);
>     public void setPreviousSibling(OMNode previousSibling);
>     public void setParent(OMContainer element);
>     public void setComplete(boolean state);
>     public void setType(int nodeType) throws OMException;
> OMContainer includes:
>     public void setComplete(boolean state);
>     public void setFirstChild(OMNode omNode);
> The availability of these functions in the interface means that clients can accidentally or intentionally misbehave and corrupt the data structures.
> For example, intentional corruption:
> OMNode next = om.getNextSibling();
> om.detach();
> next.setPreviousSibling(om);
> Or the accidental:
> OMElement parent = theParent;
> OMNode lastChild = parent.getLastChild();
> lastChild.setNextSibling(theNewSibling);  // you might reasonably think that this will insert into parent!
> Where possible, these functions ought to be defined in a package visible interface particular to the implementation package, so that only the implementation can alter crucial details that affect the integrity of the tree structure.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-241) AXIOM exposes interface functions that should be implementation details

Posted by "Eran Chinthaka (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-241?page=comments#action_12330323 ] 

Eran Chinthaka commented on AXIS2-241:
--------------------------------------

Hacking OM !!!

Yeah, I agree on this. The methods you have mentioned are being used by the builders, which are in a separate package. 
And if you try to validate the stuff within the methods, we definitely lose the perf stuff as those are frequently invoked by our "fast" builders
 
I agree that we have a prolem and think we need to think abt this carefully.  Do you have any suggestions.

Good point anyway. 

> AXIOM exposes interface functions that should be implementation details
> -----------------------------------------------------------------------
>
>          Key: AXIS2-241
>          URL: http://issues.apache.org/jira/browse/AXIS2-241
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Improvement
>   Components: om
>     Versions: 0.91
>     Reporter: Eric Johnson

>
> The OMNode interface includes functions like:
>     public void setNextSibling(OMNode node);
>     public void setPreviousSibling(OMNode previousSibling);
>     public void setParent(OMContainer element);
>     public void setComplete(boolean state);
>     public void setType(int nodeType) throws OMException;
> OMContainer includes:
>     public void setComplete(boolean state);
>     public void setFirstChild(OMNode omNode);
> The availability of these functions in the interface means that clients can accidentally or intentionally misbehave and corrupt the data structures.
> For example, intentional corruption:
> OMNode next = om.getNextSibling();
> om.detach();
> next.setPreviousSibling(om);
> Or the accidental:
> OMElement parent = theParent;
> OMNode lastChild = parent.getLastChild();
> lastChild.setNextSibling(theNewSibling);  // you might reasonably think that this will insert into parent!
> Where possible, these functions ought to be defined in a package visible interface particular to the implementation package, so that only the implementation can alter crucial details that affect the integrity of the tree structure.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira