This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Steps to reproduce: Add a recursive import statement to any WSDL file. For example add this to SynchronousSample.wsdl. <import location="SynchronousSample.wsdl" namespace="http://localhost/SynchronousSample/SynchronousSample"/> Now do anything that would cause the BPEL diagram ide to attempt to add import for that WSDL file. For instance Add Correlation Set. It will generate a stack overflow. See attachment in bug 87102. This is not a duplicate of 87102 because 87102 is a separate problem. However, both bugs were discovered at same time based on same scenario.
Here is fix for the stack overflow problem. --- ImportRegistrationHelper.java 22 Sep 2006 13:17:46 -0000 1.1.2.15 +++ ImportRegistrationHelper.java 13 Oct 2006 14:09:20 -0000 1.1.2.15.2.1 @@ -56,7 +56,11 @@ if (imps != null){ for (org.netbeans.modules.xml.wsdl.model.Import i: imps){ try { + // check if the imported model is itself #87107 + Model tmpImpModel = i.getImportedWSDLModel(); + if (tmpImpModel != null && !(tmpImpModel.equals(i.getModel()))) { addImport(i.getImportedWSDLModel()); + } } catch (CatalogModelException ex) { //Just ignore this type of exception } --------------------------------
fix has been checked in by Vitaly to release55_dev
I think the first fix does not go far enough to prevent recursive adds. If there is any cyclical import in any of the set of files, this fix will not cover that case. I propose adding a check to see if the target import file is already present in the BPEL process imports list. If it is already present we should not add it again, and we should not continue processing it recursively.
here is vitaly's latest fix. File [changed]: ResolverUtility.java Url: http://enterprise.netbeans.org/source/browse/enterprise/bpel/editors/src/org/netbeans/modules/bpel/properties/ResolverUtility.java?r1=1.1.2.26.2.1&r2=1.1.2.26.2.2 Delta lines: +16 -2 -------------------- --- ResolverUtility.java 9 Oct 2006 19:22:02 -0000 1.1.2.26.2.1 +++ ResolverUtility.java 13 Oct 2006 16:17:08 -0000 1.1.2.26.2.2 @@ -302,6 +302,20 @@ * Check if the specified model is imported to the current BPEL. */ public static boolean isModelImported(Model model, Lookup lookup) { + BpelModel bpelModel = (BpelModel)lookup.lookup(BpelModel.class); + return isModelImported(model, bpelModel); + } + + /** + * Check if the specified model is imported to the current BPEL. + */ + public static boolean isModelImported(Model model, BpelModel bpelModel) + throws IllegalStateException + { + if (model == null|| bpelModel == null) { + throw new IllegalStateException(); + } + FileObject targetModelFo = (FileObject)model.getModelSource(). getLookup().lookup(FileObject.class); if (targetModelFo == null) { @@ -310,9 +324,9 @@ return true; } } else { - FileObject bpelFolderFo = getBpelProcessFolder(lookup); + FileObject bpelFolderFo = getBpelProcessFolder(bpelModel); if (bpelFolderFo != null) { - BpelModel bpelModel = (BpelModel)lookup.lookup(BpelModel.class); + Import[] importArr = bpelModel.getProcess().getImports(); for (Import importObj : importArr) { String location = importObj.getLocation(); File [changed]: ImportRegistrationHelper.java Url: http://enterprise.netbeans.org/source/browse/enterprise/bpel/editors/src/org/netbeans/modules/bpel/properties/ImportRegistrationHelper.java?r1=1.1.2.15.2.1&r2=1.1.2.15.2.2 Delta lines: +11 -2 -------------------- --- ImportRegistrationHelper.java 13 Oct 2006 14:09:20 -0000 1.1.2.15.2.1 +++ ImportRegistrationHelper.java 13 Oct 2006 16:17:08 -0000 1.1.2.15.2.2 @@ -32,6 +32,7 @@ import org.openide.ErrorManager; import org.openide.filesystems.FileObject; +import org.openide.util.Lookup; /** * @@ -58,8 +59,16 @@ try { // check if the imported model is itself #87107 Model tmpImpModel = i.getImportedWSDLModel(); - if (tmpImpModel != null && !(tmpImpModel.equals(i.getModel()))) { - addImport(i.getImportedWSDLModel()); + boolean isRequireImport = false; + try { + isRequireImport = !ResolverUtility.isModelImported(tmpImpModel, model); + } catch (IllegalStateException ex) { + isRequireImport = false; + } + if (tmpImpModel != null && !(tmpImpModel.equals(i.getModel())) + && isRequireImport) + { + addImport(tmpImpModel); } } catch (CatalogModelException ex) { //Just ignore this type of exception
Fix looks well.
Agreed with proposed fix.
Fixed
integrated into release55
Looks like fixed ...