From 605e74dba03779e661070d412f39d537ce125f5e Mon Sep 17 00:00:00 2001 From: "Textor Andreas (BCI/ESW17)" Date: Thu, 9 Nov 2023 10:27:43 +0100 Subject: [PATCH] Remove unnecessary rewriting of XML schema location --- .../aas/AspectModelAASGenerator.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/core/esmf-aspect-model-aas-generator/src/main/java/org/eclipse/esmf/aspectmodel/aas/AspectModelAASGenerator.java b/core/esmf-aspect-model-aas-generator/src/main/java/org/eclipse/esmf/aspectmodel/aas/AspectModelAASGenerator.java index 492bbd35b..499c6cff1 100644 --- a/core/esmf-aspect-model-aas-generator/src/main/java/org/eclipse/esmf/aspectmodel/aas/AspectModelAASGenerator.java +++ b/core/esmf-aspect-model-aas-generator/src/main/java/org/eclipse/esmf/aspectmodel/aas/AspectModelAASGenerator.java @@ -15,7 +15,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Map; import java.util.function.Function; @@ -108,7 +107,7 @@ protected ByteArrayOutputStream generateXmlOutput( final Map a try ( final ByteArrayOutputStream out = new ByteArrayOutputStream() ) { final XmlSerializer serializer = new XmlSerializer(); serializer.write( out, mergedEnvironment ); - return fixSchemaLocation( out ); + return out; } catch ( final SerializationException e ) { throw new IOException( e ); } @@ -150,25 +149,9 @@ protected ByteArrayOutputStream generate( final Serializer serializer, final Asp try ( final ByteArrayOutputStream out = new ByteArrayOutputStream() ) { serializer.write( out, environment ); - // TODO must be removed as soon as https://github.com/eclipse-esmf/esmf-sdk/issues/461 is fixed - if(serializer instanceof XmlSerializer) { - return fixSchemaLocation( out ); - } return out; } catch ( final SerializationException e ) { throw new IOException( e ); } } - - // TODO must be removed as soon as https://github.com/eclipse-esmf/esmf-sdk/issues/461 is fixed - private ByteArrayOutputStream fixSchemaLocation(ByteArrayOutputStream out) throws IOException { - String document = out.toString( StandardCharsets.UTF_8 ); - String result = document.replace( - "https://admin-shell.io/aas/3/0 AAS.xsd", - "https://admin-shell.io/aas/3/0/AAS.xsd" ); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write( result.getBytes( StandardCharsets.UTF_8 ) ); - return baos; - - } }