>From the Javadoc of currentTimeMillis: "Note that while the unit of
time of the return value is a millisecond, the granularity of the
value depends on the underlying operating system and may be larger."
This is the case on (at least some versions of) Windows. Therefore
this code will not reliably generate a unique ID. There is a
UIDGenerator in Axiom that generates various types of unique IDs and
that can be used here.

Andreas

On Tue, Jan 18, 2011 at 11:46,  <[email protected]> wrote:
> Author: isurues
> Date: Tue Jan 18 10:46:36 2011
> New Revision: 1060294
>
> URL: http://svn.apache.org/viewvc?rev=1060294&view=rev
> Log:
> fixing https://issues.apache.org/jira/browse/AXIS2-4929. Using a unique id 
> when reading a schema using the SchemaCollection
>
> Modified:
>    
> axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
>
> Modified: 
> axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
> URL: 
> http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java?rev=1060294&r1=1060293&r2=1060294&view=diff
> ==============================================================================
> --- 
> axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
>  (original)
> +++ 
> axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
>  Tue Jan 18 10:46:36 2011
> @@ -39,6 +39,7 @@ import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>  import org.apache.ws.commons.schema.XmlSchema;
>  import org.apache.ws.commons.schema.XmlSchemaCollection;
> +import org.w3c.dom.Document;
>  import org.xml.sax.InputSource;
>
>  import javax.servlet.ServletConfig;
> @@ -47,6 +48,7 @@ import javax.wsdl.Definition;
>  import javax.wsdl.WSDLException;
>  import javax.wsdl.factory.WSDLFactory;
>  import javax.wsdl.xml.WSDLReader;
> +import javax.xml.parsers.DocumentBuilderFactory;
>  import javax.xml.ws.WebServiceException;
>  import javax.xml.ws.soap.SOAPBinding;
>  import java.io.ByteArrayOutputStream;
> @@ -321,9 +323,18 @@ public class JAXWSRIWSDLGenerator implem
>             schemaCollection.setBaseUri(new 
> File(localOutputDirectory).getAbsolutePath());
>
>             HashMap<String, XmlSchema> docMap = new HashMap<String, 
> XmlSchema>();
> +
> +            // Doc factory to read schema files
> +            DocumentBuilderFactory fac = 
> DocumentBuilderFactory.newInstance();
> +            fac.setNamespaceAware(true);
> +
>             List<File> schemaFiles = getSchemaFiles(localOutputDirectory);
>             for (File schemaFile : schemaFiles) {
> -                XmlSchema doc = schemaCollection.read(new 
> InputSource(schemaFile.toURL().toString()), null);
> +                // generate dom document for current schema file
> +                Document parsedDoc = 
> fac.newDocumentBuilder().parse(schemaFile.toURL().toString());
> +                // read the schema through XmlSchema
> +                XmlSchema doc = 
> schemaCollection.read(parsedDoc.getDocumentElement(),
> +                        "id-" + System.currentTimeMillis());
>                 if (log.isDebugEnabled()) {
>                     log.debug("Read in schema file: " + schemaFile.getName());
>                 }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to