Author: jim.ma
Date: 2012-11-13 09:45:27 -0500 (Tue, 13 Nov 2012)
New Revision: 16971
Modified:
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
Log:
[JBPAPP-10380]:Fix JBWS2526TestCase
Modified:
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
===================================================================
---
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2012-11-13
08:31:21 UTC (rev 16970)
+++
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2012-11-13
14:45:27 UTC (rev 16971)
@@ -513,7 +513,7 @@
/** Get the temp file for a given namespace
*/
- public static File getSchemaTempFile(String targetNS, String fileName) throws
IOException
+ public static File getSchemaTempFile(String targetNS, byte[] fileContent) throws
IOException
{
if (targetNS.length() == 0)
throw new IllegalArgumentException("Invalid null target namespace");
@@ -544,11 +544,11 @@
fname = fname.replace('#', '_');
File file = null;
- if (fileName != null)
+ if (fileContent != null)
{
try
{
- String fileNameHash =
toHexString(MessageDigest.getInstance("MD5").digest(fileName.getBytes("UTF-8")));
+ String fileNameHash =
toHexString(MessageDigest.getInstance("MD5").digest(fileContent));
if(tmpdir == null)
{
tmpdir = (File) AccessController.doPrivileged(new PrivilegedAction() {
Modified:
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
---
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2012-11-13
08:31:21 UTC (rev 16970)
+++
stack/native/tags/jbossws-native-3.1.2.SP14/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2012-11-13
14:45:27 UTC (rev 16971)
@@ -21,10 +21,14 @@
*/
package org.jboss.ws.tools.wsdl;
+import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -109,6 +113,7 @@
import org.jboss.ws.tools.JavaToXSD;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.common.IOUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -267,7 +272,8 @@
{
for (File current : tempFiles)
{
- current.deleteOnExit();
+ //TODO: look at how to remove tmp file correctly
+ //current.delete();
}
}
@@ -530,6 +536,17 @@
importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
+ byte[] wsdlContent = null;
+
+ InputStream inputStream = wsdlLoc.openStream();
+
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ IOUtils.copyStream(bout, inputStream);
+ wsdlContent = bout.toByteArray();
+ inputStream.close();
+ bout.close();
+
+
String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
File tmpFile = null;
@@ -544,14 +561,14 @@
{
log.trace("processSchemaInclude: [targetNS=" + targetNS +
",parentURL=" + wsdlLoc + "]");
- tmpFile = SchemaUtils.getSchemaTempFile(targetNS, getFileName(wsdlLoc));
+ tmpFile = SchemaUtils.getSchemaTempFile(targetNS, wsdlContent);
tempFiles.add(tmpFile);
publishedLocations.put(wsdlLoc, tmpFile.toURL());
}
else
{
- tmpFile = SchemaUtils.getSchemaTempFile("no_namespace",
getFileName(wsdlLoc));
+ tmpFile = SchemaUtils.getSchemaTempFile("no_namespace", wsdlContent);
tempFiles.add(tmpFile);
publishedLocations.put(wsdlLoc, tmpFile.toURL());
Show replies by date