// and fix it
imd = cleanseMetadataForRepository(RepositoryPolicy.SNAPSHOT.equals(getRepositoryPolicy()), imd);
// serialize and swap the new metadata
MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(bos);
metadataWriter.write(osw, imd);
mdFile.setContentLocator(new ByteArrayContentLocator(bos.toByteArray(), mdFile.getMimeType()));
}
catch (Exception e) {
log.error("Exception during repository metadata cleansing.", e);