Encoding errors in wsdlmerge tool
---------------------------------
Key: MUSE-308
URL: https://issues.apache.org/jira/browse/MUSE-308
Project: Muse
Issue Type: Bug
Components: Tooling - Code Generation
Affects Versions: 2.2.0
Reporter: Lars Andersen
Assignee: Dan Jemiolo
I have been looking into using the wsdlmerge tool. I noticed that the resulting
file often contains encoding errors. For example merging two UTF-8 wsdl files
results in a wsdl file that has encoding="UTF-8" in the xml content, but
actually is encoded with Cp1252.
Looking in the source reveals the error : the merged wsdl file is written using
FileWriter, which simply uses whatever encoding is default on the system, and
pays no attention to the xml encoding.
The code in question is found in
"muse-tools/src/org/apache/muse/tools/generator/WsdlMerge.java'
I have with success changed the code like this :
>>>>>>>>>>>>> CODE BEGINS <<<<<<<<<<<<<<<<<<<<<
private static void writeWsdl(String fileName, Definition mergedDefinition,
boolean overwrite) {
System.out.println("*** writeWsdl");
File wsdlDestination = new File(fileName);
if (!wsdlDestination.exists() || overwrite) {
try {
checkParentDirectory(wsdlDestination.getAbsoluteFile().getParentFile());
Document wsdlDoc = _writer.getDocument(mergedDefinition);
String enc = "UTF-8";
if (wsdlDoc.getXmlEncoding()!=null)
{
enc = wsdlDoc.getXmlEncoding();
}
FileOutputStream fileOut = new
FileOutputStream(wsdlDestination);
fileOut.write(XmlUtils.toString(wsdlDoc).getBytes(enc));
fileOut.close();
} catch (Exception e) {
Object[] filler = {wsdlDestination.getAbsolutePath()};
throw new MuseRuntimeException("FailedWritingWsdl",
_MESSAGES.get("FailedWritingWsdl", filler), e);
}
} else {
handleMessage(_MESSAGES.get("NotOverwriting", new String[]
{wsdlDestination.getPath()}));
}
}
>>>>>>>>>>>>> CODE ENDS <<<<<<<<<<<<<<<<<<<<<
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]