diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java index 7052d6afb6..dc5089f57a 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java @@ -12,8 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. -*/ - + */ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types; import com.fasterxml.jackson.dataformat.xml.XmlMapper; @@ -23,28 +22,23 @@ import org.openecomp.sdc.vendorlicense.errors.JsonErrorBuilder; public abstract class XmlArtifact { - XmlMapper xmlMapper = new XmlMapper(); - - abstract void initMapper(); - - /** - * To xml string. - * - * @return the string - */ - public String toXml() { - initMapper(); - String xml; - - try { - xml = xmlMapper.writeValueAsString(this); - } catch (com.fasterxml.jackson.core.JsonProcessingException exception) { - throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ") - .build(), exception); + XmlMapper xmlMapper = new XmlMapper(); + + abstract void initMapper(); + + /** + * To xml string. + * + * @return the string + */ + public String toXml() { + initMapper(); + String xml; + try { + xml = xmlMapper.writeValueAsString(this); + } catch (com.fasterxml.jackson.core.JsonProcessingException exception) { + throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ").build(), exception); + } + return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, ""); } - - return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, ""); - } - - } |