This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
commit 0a09f522ac65a4ae587e0c69e273fddd77ebdfdb Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Feb 9 14:35:08 2021 +0000 Track whether source was modified or not. --- .../apache/tomcat/jakartaee/ManifestConverter.java | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/tomcat/jakartaee/ManifestConverter.java b/src/main/java/org/apache/tomcat/jakartaee/ManifestConverter.java index 3a89ae2..e177217 100644 --- a/src/main/java/org/apache/tomcat/jakartaee/ManifestConverter.java +++ b/src/main/java/org/apache/tomcat/jakartaee/ManifestConverter.java @@ -52,10 +52,16 @@ public class ManifestConverter implements Converter { Manifest srcManifest = new Manifest(src); Manifest destManifest = new Manifest(srcManifest); - removeSignatures(destManifest); - updateValues(destManifest, profile); + boolean result = false; - destManifest.write(dest); + result = result | removeSignatures(destManifest); + result = result | updateValues(destManifest, profile); + + if (result) { + destManifest.write(dest); + } else { + srcManifest.write(dest); + } } @@ -90,23 +96,33 @@ public class ManifestConverter implements Converter { } - private void updateValues(Manifest manifest, EESpecProfile profile) { - updateValues(manifest.getMainAttributes(), profile); + private boolean updateValues(Manifest manifest, EESpecProfile profile) { + boolean result = false; + result = result | updateValues(manifest.getMainAttributes(), profile); for (Attributes attributes : manifest.getEntries().values()) { - updateValues(attributes, profile); + result = result | updateValues(attributes, profile); } + return result; } - private void updateValues(Attributes attributes, EESpecProfile profile) { + private boolean updateValues(Attributes attributes, EESpecProfile profile) { + boolean result = false; // Update version info if (attributes.containsKey(Attributes.Name.IMPLEMENTATION_VERSION)) { String newValue = attributes.get(Attributes.Name.IMPLEMENTATION_VERSION) + "-" + Info.getVersion(); attributes.put(Attributes.Name.IMPLEMENTATION_VERSION, newValue); + result = true; } // Update package names in values for (Entry<Object,Object> entry : attributes.entrySet()) { - entry.setValue(profile.convert((String) entry.getValue())); + String newValue = profile.convert((String) entry.getValue()); + // Object comparison is deliberate + if (newValue != entry.getValue()) { + entry.setValue(newValue); + result = true; + } } + return result; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org