oops! forgot the change in WSDL11Writer.

thanks,
dims

On 8/1/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote:
> Deepal,
>
> Here's the diff i'd like to merge from trunk to 1.3 branch:
>
> - Fix for UTF-16LE/BE in transport header content type instead of just
> UTF-16 (Interop problem with WCF/Indigo)
> - Fix for circular wsdl's. (Found during WCF/Interop testing)
> - Fix for "Duplicate Global type" during xmlbeans codegen
> - Fix for NPE in AxisServlet (found during trying to send soap message
> from jython)
>
> thanks,
> dims
>
> On 8/1/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote:
> > Deepal, Folks,
> >
> > Suggestion #1: I think we have accumulated a lot of code changes since
> > last RC and since we have time, let's please cut another RC.
> >
> > Suggestion #2: There are some significant changes in trunk that needs
> > to be merged into branch. I was working on them and did not realize
> > that the RM would freeze the branch last night. Could we please merge
> > them?
> >
> > Suggestion #3: In future, Can we please amend the policy to give some
> > notice before a code freeze? say 24hrs?
> >
> > thanks,
> > dims
> >
> > --
> > Davanum Srinivas :: http://davanum.wordpress.com
> >
>
>
> --
> Davanum Srinivas :: http://davanum.wordpress.com
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com
--- modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java	Wed Aug 01 14:26:56 2007
+++ modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java	Fri Jul 20 12:47:54 2007
@@ -39,7 +39,6 @@
 import java.util.Map;
 import java.util.Vector;
 import java.util.ArrayList;
-import java.util.Stack;
 
 public class WSDL11Writer {
 
@@ -77,7 +76,7 @@
     public void writeWSDL(AxisService axisService, Definition definition, Map changedMap) {
         try {
             if (axisService != null) {
-                writeWSDL(definition, axisService.getName(), changedMap, new Stack());
+                writeWSDL(definition, axisService.getName(), changedMap);
             }
         } catch (Exception e) {
             throw new RuntimeException("WSDL writing failed!", e);
@@ -86,9 +85,7 @@
 
     private void writeWSDL(Definition definition,
                            String serviceName,
-                           Map changedMap,
-                           Stack stack) throws Exception {
-        stack.push(definition);
+                           Map changedMap) throws Exception {
         // first process the imports and save them.
         Map imports = definition.getImports();
         if (imports != null && (imports.size() > 0)) {
@@ -101,16 +98,13 @@
                 for (Iterator importsIter = importsVector.iterator(); importsIter.hasNext();) {
                     wsdlImport = (Import)importsIter.next();
                     wsdlName = "wsdl_" + count++ + ".wsdl";
-                    Definition innerDefinition = wsdlImport.getDefinition();
-                    if(!stack.contains(innerDefinition)) {
-                        writeWSDL(innerDefinition, wsdlName, changedMap, stack);
-                    }
+                    writeWSDL(wsdlImport.getDefinition(), wsdlName, changedMap);
                     wsdlImport.setLocationURI(wsdlName);
                 }
             }
         }
         // change the locations on the imported schemas
-        adjustWSDLSchemaLocations(definition, changedMap);
+        adjustWSDLSchemaLocatins(definition, changedMap);
         // finally save the file
         WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
         File outputFile = FileWriter.createClassFile(baseFolder,
@@ -154,25 +148,14 @@
         }
         out.flush();
         out.close();
-        stack.pop();
-    }
-
-    /**
-     * @deprecated  please use adjustWSDLSchemaLocations
-     * @param definition
-     * @param changedSchemaLocations
-     */
-    public void adjustWSDLSchemaLocatins(Definition definition, Map changedSchemaLocations) {
-        adjustWSDLSchemaLocations(definition, changedSchemaLocations);
     }
     
     /**
      * adjust the schema locations in the original wsdl
      *
-     * @param definition
-     * @param changedSchemaLocations
+     * @param changedScheamLocations
      */
-    public void adjustWSDLSchemaLocations(Definition definition, Map changedSchemaLocations) {
+    public void adjustWSDLSchemaLocatins(Definition definition, Map changedScheamLocations) {
         Types wsdlTypes = definition.getTypes();
         if (wsdlTypes != null) {
             List extensibilityElements = wsdlTypes.getExtensibilityElements();
@@ -182,7 +165,7 @@
                 currentObject = iter.next();
                 if (currentObject instanceof Schema) {
                     schema = (Schema)currentObject;
-                    changeLocations(schema.getElement(), changedSchemaLocations);
+                    changeLocations(schema.getElement(), changedScheamLocations);
                 }
             }
         }
--- modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java	Wed Aug 01 13:48:41 2007
+++ modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java	Fri Jul 20 12:40:58 2007
@@ -670,8 +670,7 @@
         if ((charsetEncodingFromXML != null)
                 && !"".equals(charsetEncodingFromXML)
                 && (charsetEncodingFromTransport != null)
-                && !charsetEncodingFromXML.equalsIgnoreCase(charsetEncodingFromTransport)
-                && !isValidPair(charsetEncodingFromXML, charsetEncodingFromTransport))
+                && !charsetEncodingFromXML.equalsIgnoreCase((String) charsetEncodingFromTransport))
         {
             String faultCode;
 
@@ -682,27 +681,8 @@
             }
 
             throw new AxisFault("Character Set Encoding from "
-                    + "transport information [" + charsetEncodingFromTransport + "] does not match with "
-                    + "character set encoding in the received SOAP message [" + charsetEncodingFromXML + "]", faultCode);
+                    + "transport information do not match with "
+                    + "character set encoding in the received SOAP message", faultCode);
         }
-    }
-
-    /**
-     * check if the pair is [UTF-16,UTF-16LE] [UTF-32, UTF-32LE],[UTF-16,UTF-16BE] [UTF-32, UTF-32BE] etc.
-     * 
-     * @param enc1
-     * @param enc2
-     * @return
-     */
-    private static boolean isValidPair(String enc1, String enc2) {
-        enc1 = enc1.toLowerCase();
-        enc2 = enc2.toLowerCase();
-        if (enc1.endsWith("be") || enc1.endsWith("le")) {
-            enc1 = enc1.substring(0, enc1.length() - 2);
-        }
-        if (enc2.endsWith("be") || enc2.endsWith("le")) {
-            enc2 = enc2.substring(0, enc2.length() - 2);
-        }
-        return enc1.equals(enc2);
     }
 }
--- modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java	Wed Aug 01 11:50:57 2007
+++ modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java	Wed Aug 01 08:38:58 2007
@@ -294,12 +294,6 @@
 
     private void processTypes(Definition wsdlDefinition, AxisService axisService)
             throws AxisFault {
-        processTypes(wsdlDefinition, axisService, new Stack());
-    }
-
-    private void processTypes(Definition wsdlDefinition, AxisService axisService, Stack stack)
-            throws AxisFault {
-        stack.push(wsdlDefinition);
         // process all the types in all the wsdls
         Types types = wsdlDefinition.getTypes();
         if (types != null) {
@@ -318,14 +312,10 @@
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
                 // process the types recuresiveilt
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(!stack.contains(innerDefinition)){
-                    processTypes(innerDefinition, axisService, stack);
+                processTypes(wsdlImport.getDefinition(), axisService);
                 }
             }
         }
-        stack.pop();
-    }
 
     private void addDocumentation(AxisDescription axisDescription, Element documentationElement) {
         if ((documentationElement != null) && (documentationElement.getFirstChild() != null)) {
@@ -644,7 +634,7 @@
 
         // setup the schemaMap
         this.schemaMap = new HashMap();
-        populateSchemaMap(wsdl4jDefinition, new Stack());
+        populateSchemaMap(wsdl4jDefinition);
 
         setPolicyRegistryFromService(axisService);
 
@@ -660,8 +650,8 @@
      * @param definition
      */
 
-    private void populateSchemaMap(Definition definition, Stack stack) {
-        stack.push(definition);
+    private void populateSchemaMap(Definition definition) {
+
         Types types = definition.getTypes();
         Object extensibilityElement;
         if (types != null) {
@@ -683,14 +673,10 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(!stack.contains(innerDefinition)) {
-                    populateSchemaMap(innerDefinition, stack);
+                populateSchemaMap(wsdlImport.getDefinition());
                 }
             }
         }
-        stack.pop();
-    }
 
 
     /**
@@ -838,19 +824,6 @@
      */
 
     private PortType getPortType(QName portTypeQName, Definition definition) {
-        return getPortType(portTypeQName, definition, new Stack());
-    }
-
-    /**
-     * get the port type form all the imported documents
-     *
-     * @param portTypeQName
-     * @param definition
-     * @return portType
-     */
-
-    private PortType getPortType(QName portTypeQName, Definition definition, Stack stack) {
-        stack.push(definition);
         PortType portType = null;
         Iterator iter = definition.getImports().values().iterator();
         Vector values = null;
@@ -859,15 +832,12 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(stack.contains(innerDefinition)){
                     // find the binding recursively
-                    portType = getPortType(portTypeQName, innerDefinition, stack);
+                portType = getPortType(portTypeQName, wsdlImport.getDefinition());
                     if (portType != null) {
                         break;
                     }
                 }
-            }
             if (portType != null) {
                 break;
             }
@@ -877,25 +847,9 @@
             // this can be in a imported wsdl
             portType = definition.getPortType(portTypeQName);
         }
-        stack.pop();
         return portType;
     }
 
-    private Binding getBinding(QName bindingQName, Definition definition) {
-        ArrayList list = new ArrayList();
-        Binding binding = getBinding(bindingQName, definition, list);
-        if (binding == null) {
-            for(int i=0;i<list.size();i++){
-                Binding binding2 = definition.getBinding(bindingQName);
-                if(binding2 != null && binding2.getPortType() != null){
-                    binding = binding2;
-                    break;
-                }
-            }
-        }
-        return binding;
-    }
-
     /**
      * first find the binding in the given definition
      * if not found serch in the imported doucuments
@@ -905,8 +859,8 @@
      * @return binding
      */
 
-    private Binding getBinding(QName bindingQName, Definition definition, ArrayList list) {
-        list.add(definition);
+    private Binding getBinding(QName bindingQName, Definition definition) {
+
         Binding binding = null;
         //first try to find a binding in the upper inmport
         Iterator iter = definition.getImports().values().iterator();
@@ -916,19 +870,20 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(!list.contains(innerDefinition)) {
                     // find the binding recursively
-                    binding = getBinding(bindingQName, innerDefinition, list);
+                binding = getBinding(bindingQName, wsdlImport.getDefinition());
                     if (binding != null) {
                         break;
                     }
                 }
-            }
             if (binding != null) {
                 break;
             }
         }
+
+        if (binding == null) {
+            binding = definition.getBinding(bindingQName);
+        }
         return binding;
     }
 
@@ -2599,16 +2554,7 @@
      * @param definition
      */
     private void processPoliciesInDefintion(Definition definition) {
-        processPoliciesInDefintion(definition, new Stack());
-    }
 
-    /**
-     * Process the policy definitions
-     *
-     * @param definition
-     */
-    private void processPoliciesInDefintion(Definition definition, Stack stack) {
-        stack.push(definition);
         List extElements = definition.getExtensibilityElements();
         ExtensibilityElement extElement;
         UnknownExtensibilityElement unknown = null;
@@ -2639,14 +2585,10 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
                 // find the binding recursively
-                if(!stack.contains(innerDefinition)) {
-                    processPoliciesInDefintion(innerDefinition, stack);
-                }
+                processPoliciesInDefintion(wsdlImport.getDefinition());
             }
         }
-        stack.pop();
     }
 
 
--- modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java	Wed Aug 01 17:10:23 2007
+++ modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java	Mon Jul 23 01:10:29 2007
@@ -25,7 +25,6 @@
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPFaultCode;
-import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
@@ -309,17 +308,16 @@
     private void closeStaxBuilder(MessageContext messageContext) throws ServletException {
         if (closeReader && messageContext != null) {
             try {
-                SOAPEnvelope envelope = messageContext.getEnvelope();
-                if(envelope != null) {
-                    StAXBuilder builder = (StAXBuilder) envelope.getBuilder();
+                StAXBuilder builder = (StAXBuilder) messageContext.getEnvelope().getBuilder();
                     if (builder != null) {
                         builder.close();
                     }
-                }
             } catch (Exception e) {
-                log.debug(e.toString(), e);
+                log.debug(e);
+                throw new ServletException(e);
             }
         }
+
     }
 
     /**
--- modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java	Wed Aug 01 10:01:56 2007
+++ modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java	Fri Jul 27 01:24:17 2007
@@ -61,9 +61,6 @@
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -622,7 +619,11 @@
                             source.setSystemId(schema.getSourceURI());
                             return source;
                         } else {
-                            return new InputSource(getSchemaAsInputStream(schemas[i]));
+                            try {
+                                return new InputSource(getSchemaAsReader(schemas[i]));
+                            } catch (IOException e) {
+                                throw new RuntimeException(e);
+                            }
                         }
                     }
 
@@ -631,7 +632,11 @@
                     XmlSchema schema = schemas[i];
                     if (schema.getTargetNamespace() != null &&
                             schema.getTargetNamespace().equals(publicId)) {
-                        return new InputSource(getSchemaAsInputStream(schemas[i]));
+                        try {
+                            return new InputSource(getSchemaAsReader(schemas[i]));
+                        } catch (IOException e) {
+                            throw new RuntimeException(e);
+                        }
                     }
                 }
                 if (systemId.indexOf(':') == -1) {
@@ -682,10 +687,11 @@
          *
          * @param schema
          */
-        private InputStream getSchemaAsInputStream(XmlSchema schema){
-         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-         schema.write(baos);
-         return new ByteArrayInputStream(baos.toByteArray());
+        private StringReader getSchemaAsReader(XmlSchema schema) throws IOException {
+            StringWriter writer = new StringWriter();
+            schema.write(writer);
+            writer.flush();
+            return new StringReader(writer.toString());
         }
     }
 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to