axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <tjord...@adobe.com>
Subject RE: svn commit: r1060294 - /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
Date Tue, 18 Jan 2011 14:58:45 GMT
The JDK also has a UUID API which can be used that has several options for UUID generation:
  http://download.oracle.com/javase/1.5.0/docs/api/java/util/UUID.html


Tom Jordahl

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Tuesday, January 18, 2011 6:49 AM
To: java-dev@axis.apache.org
Subject: Re: svn commit: r1060294 - /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java

>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,  <isurues@apache.org> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message