You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/08/02 14:16:16 UTC
svn commit: r562092 -
/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Author: jkaputin
Date: Thu Aug 2 05:16:16 2007
New Revision: 562092
URL: http://svn.apache.org/viewvc?view=rev&rev=562092
Log:
WODEN-159
Fix to detect a circular reference in interface
extension and avoid an infinite loop when processing
interface faults and operations.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java?view=diff&rev=562092&r1=562091&r2=562092
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java Thu Aug 2 05:16:16 2007
@@ -135,8 +135,9 @@
*/
public InterfaceFault[] getAllInterfaceFaults()
{
+ List allInterfaces = new Vector();
List allInterfaceFaults = new Vector();
- getAllInterfaceFaults(this, allInterfaceFaults);
+ getAllInterfaceFaults(this, allInterfaces, allInterfaceFaults);
InterfaceFault[] array = new InterfaceFault[allInterfaceFaults.size()];
allInterfaceFaults.toArray(array);
@@ -186,8 +187,9 @@
*/
public InterfaceOperation[] getAllInterfaceOperations()
{
+ List allInterfaces = new Vector();
List allInterfaceOperations = new Vector();
- getAllInterfaceOperations(this, allInterfaceOperations);
+ getAllInterfaceOperations(this, allInterfaces, allInterfaceOperations);
InterfaceOperation[] array = new InterfaceOperation[allInterfaceOperations.size()];
allInterfaceOperations.toArray(array);
@@ -470,7 +472,14 @@
* from interfaces that it extends, directly or indirectly, and accumulate them in
* the specified List. Eliminate duplicate operations.
*/
- private void getAllInterfaceOperations(Interface interfac, List allOpers) {
+ private void getAllInterfaceOperations(Interface interfac, List allInterfaces, List allOpers) {
+ //check for circular Interface references to avoid infinite loop
+ if(containsComponent(interfac, allInterfaces)) {
+ return;
+ } else {
+ allInterfaces.add(interfac);
+ }
+
//get the declared operations for the specified Interface
InterfaceOperation[] declaredOpers = interfac.getInterfaceOperations();
for(int i=0; i<declaredOpers.length; i++) {
@@ -483,7 +492,7 @@
//get the derived operations from each extended interface
Interface[] extInts = interfac.getExtendedInterfaces();
for(int j=0; j<extInts.length; j++) {
- getAllInterfaceOperations(extInts[j], allOpers);
+ getAllInterfaceOperations(extInts[j], allInterfaces, allOpers);
}
}
@@ -492,7 +501,14 @@
* from interfaces that it extends, directly or indirectly, and accumulate them in
* the specified List. Eliminate duplicate faults.
*/
- private void getAllInterfaceFaults(Interface interfac, List allFaults) {
+ private void getAllInterfaceFaults(Interface interfac, List allInterfaces, List allFaults) {
+ //check for circular Interface references to avoid infinite loop
+ if(containsComponent(interfac, allInterfaces)) {
+ return;
+ } else {
+ allInterfaces.add(interfac);
+ }
+
//get the declared faults for the specified Interface
InterfaceFault[] declaredFaults = interfac.getInterfaceFaults();
for(int i=0; i<declaredFaults.length; i++) {
@@ -505,7 +521,7 @@
//get the derived faults from each extended interface
Interface[] extInts = interfac.getExtendedInterfaces();
for(int j=0; j<extInts.length; j++) {
- getAllInterfaceFaults(extInts[j], allFaults);
+ getAllInterfaceFaults(extInts[j], allInterfaces, allFaults);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org