Better error handling. webapi_public_112441_trunk_merge_2
authorjqian@netbeans.org
Mon, 10 Sep 2007 21:40:10 +0000
changeset 117620d7fc5f1eec
parent 1175 b90f870f7dc8
child 1177 1181cc572742
Better error handling.
compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/CasaBuilder.java
compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/wsdlRepository.java
     1.1 --- a/compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/CasaBuilder.java	Mon Sep 10 11:33:52 2007 +0000
     1.2 +++ b/compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/CasaBuilder.java	Mon Sep 10 21:40:10 2007 +0000
     1.3 @@ -1061,10 +1061,13 @@
     1.4                      QName serviceQName = new QName(tns, service.getName()); 
     1.5                      for (Port port : service.getPorts()) {
     1.6                          String portName = port.getName();
     1.7 -                        QName interfaceQName = port.getBinding().get().getType().getQName();
     1.8 -                        Endpoint endpoint = new Endpoint(portName, serviceQName, interfaceQName);
     1.9 -                        if (!newWsdlEndpoints.contains(endpoint)) {
    1.10 -                            newWsdlEndpoints.add(endpoint);
    1.11 +                        Binding binding = port.getBinding().get();
    1.12 +                        if (binding != null) { 
    1.13 +                            QName interfaceQName = binding.getType().getQName();
    1.14 +                            Endpoint endpoint = new Endpoint(portName, serviceQName, interfaceQName);
    1.15 +                            if (!newWsdlEndpoints.contains(endpoint)) {
    1.16 +                                newWsdlEndpoints.add(endpoint);
    1.17 +                            }
    1.18                          }
    1.19                      }
    1.20                  }
     2.1 --- a/compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/wsdlRepository.java	Mon Sep 10 11:33:52 2007 +0000
     2.2 +++ b/compapp.projects.jbi/antsrc/org/netbeans/modules/compapp/projects/jbi/anttasks/wsdlRepository.java	Mon Sep 10 21:40:10 2007 +0000
     2.3 @@ -29,6 +29,7 @@
     2.4  import java.util.Map;
     2.5  import javax.swing.text.Document;
     2.6  import javax.swing.text.PlainDocument;
     2.7 +import org.apache.tools.ant.BuildException;
     2.8  import org.netbeans.modules.compapp.projects.jbi.descriptor.endpoints.model.PtConnection;
     2.9  import org.netbeans.modules.compapp.projects.jbi.ui.customizer.JbiProjectProperties;
    2.10  import org.netbeans.modules.xml.wsdl.model.*;
    2.11 @@ -333,23 +334,28 @@
    2.12                  
    2.13                  // Collect services... (Serivce QName -> Service)
    2.14                  for (Service s : def.getServices()) {
    2.15 -                    String skey = getQName(tns, s.getName());
    2.16 -                    if (services.get(skey) != null) {
    2.17 -                        System.out.println("Duplicate Service: " + skey);
    2.18 +                    String sQName = getQName(tns, s.getName());
    2.19 +                    if (services.get(sQName) != null) {
    2.20 +                        System.out.println("Duplicate Service: " + sQName);
    2.21                      } else {
    2.22 -                        services.put(skey, s);
    2.23 +                        services.put(sQName, s);
    2.24                      }
    2.25  
    2.26 -                    // Collect ports... (Port QName -> Port)
    2.27 +                    // Collect ports... (ServiceQName + Port Name -> Port)
    2.28                      for (Port p : s.getPorts()) {
    2.29 -                        String key = skey + "." + p.getName(); 
    2.30 +                        String key = sQName + "." + p.getName(); 
    2.31                          if (ports.get(key) != null) {
    2.32                              System.out.println("Duplicate Port: " + key);
    2.33                          } else {
    2.34                              ports.put(key, p);
    2.35                              
    2.36 -                            String ptkey = p.getBinding().get().getType().getQName().toString();
    2.37 -                            PtConnection ptCon = connections.get(ptkey);
    2.38 +                            Binding binding = p.getBinding().get();
    2.39 +                            if (binding == null) {
    2.40 +                                throw new BuildException(
    2.41 +                                    "ERROR: Missing binding for WSDL port " + key);
    2.42 +                            }
    2.43 +                            String ptQName = binding.getType().getQName().toString();
    2.44 +                            PtConnection ptCon = connections.get(ptQName);
    2.45                              if (ptCon != null) {
    2.46                                  ptCon.addPort(p);
    2.47                              }