[#7579] [#8044] Ignore exceptions that occur during the workaround

This commit is contained in:
lukaseder 2018-11-20 10:26:55 +01:00
parent 8197c65fbb
commit f85abe82f7

View File

@ -330,10 +330,14 @@ public class MiniJAXB {
*/
public static String jaxbNamespaceBugWorkaround(String xml, Object annotated) {
StringWriter test = new StringWriter();
JAXB.marshal(annotated, test);
if (!test.toString().contains("xmlns"))
xml = xml.replaceAll("xmlns=\"[^\"]*\"", "");
try {
JAXB.marshal(annotated, test);
if (!test.toString().contains("xmlns"))
xml = xml.replaceAll("xmlns=\"[^\"]*\"", "");
}
catch (Exception ignore) {}
return xml;
}