You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fs...@apache.org on 2020/02/09 14:22:32 UTC

[tomcat-jakartaee-migration] branch master updated (8207a5d -> 1418dfd)

This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git.


    from 8207a5d  Simplify code
     new 85d6dec  Markup changes
     new 1418dfd  Add warnings in the log for each removed signature

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                                      | 10 +++++++++-
 src/main/java/org/apache/tomcat/jakartaee/Migration.java       | 10 +++++++---
 .../org/apache/tomcat/jakartaee/LocalStrings.properties        |  3 ++-
 3 files changed, 18 insertions(+), 5 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat-jakartaee-migration] 01/02: Markup changes

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 85d6dec49a8b00fa39c552fbd6ab325cdc5de31d
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sun Feb 9 15:19:51 2020 +0100

    Markup changes
---
 README.md | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 9f6717e..637c529 100644
--- a/README.md
+++ b/README.md
@@ -27,10 +27,13 @@ The source should be a path to a compressed archive, a folder or an individual f
 Jakarta EE 9 is still under development and there are some details that remain to be worked out.
 
 The differences currently supported by this tool are:
-* Renaming packages for Jakarta EE 9 APIs from javax.* to jakarta.*
+
+* Renaming packages for Jakarta EE 9 APIs from `javax.*` to `jakarta.*`
 
 The differences yet to be implemented by this tool are:
+
 * Remaining issues once resolved
 
 The issues still to be resolved by the Jakarta EE projects that will impact this tool are:
+
 * XML schemas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat-jakartaee-migration] 02/02: Add warnings in the log for each removed signature

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 1418dfd906bb4bbe405a1ce835617231e8ac1177
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sun Feb 9 15:19:15 2020 +0100

    Add warnings in the log for each removed signature
---
 README.md                                                      |  5 +++++
 src/main/java/org/apache/tomcat/jakartaee/Migration.java       | 10 +++++++---
 .../org/apache/tomcat/jakartaee/LocalStrings.properties        |  3 ++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 637c529..990718e 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,11 @@ Migrate your Servlet application with:
 
 The source should be a path to a compressed archive, a folder or an individual file. The destination will be created at the specified path as a resource of the same type as the source.
 
+> **INFO**
+> This tool will remove cryptographic signatures from JAR files contained in the *source*, as the changed resources would not match them anymore.
+>
+> A warning will be logged for each JAR file where the signature has been removed.
+
 ## Differences between Java EE 8 and Jakarta EE 9
 
 Jakarta EE 9 is still under development and there are some details that remain to be worked out.
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index f2eed3f..1140f26 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -139,7 +139,9 @@ public class Migration {
                 // Otherwise messing with signatures will fail
                 manifest = new Manifest(manifest);
                 updateVersion(manifest);
-                removeSignatures(manifest);
+                if (removeSignatures(manifest)) {
+                    logger.log(Level.WARNING, sm.getString("migration.warnSignatureRemoval"));
+                }
                 JarEntry manifestEntry = new JarEntry(JarFile.MANIFEST_NAME);
                 jarOs.putNextEntry(manifestEntry);
                 manifest.write(jarOs);
@@ -185,8 +187,8 @@ public class Migration {
     }
 
 
-    private void removeSignatures(Manifest manifest) {
-        manifest.getMainAttributes().remove(Attributes.Name.SIGNATURE_VERSION);
+    private boolean removeSignatures(Manifest manifest) {
+        boolean removedSignatures = manifest.getMainAttributes().remove(Attributes.Name.SIGNATURE_VERSION) != null;
         List<String> signatureEntries = new ArrayList<>();
         Map<String, Attributes> manifestAttributeEntries = manifest.getEntries();
         for (Entry<String, Attributes> entry : manifestAttributeEntries.entrySet()) {
@@ -194,10 +196,12 @@ public class Migration {
                 String entryName = entry.getKey();
                 signatureEntries.add(entryName);
                 logger.log(Level.FINE, sm.getString("migration.removeSignature", entryName));
+                removedSignatures = true;
             }
         }
         signatureEntries.stream()
             .forEach(manifestAttributeEntries::remove);
+        return removedSignatures;
     }
 
 
diff --git a/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties b/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties
index 2f9560d..d13091f 100644
--- a/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties
+++ b/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties
@@ -23,4 +23,5 @@ migration.mkdirError=Error creating destination directory [{0}]
 migration.removeSignature=Remove cryptographic signature for [{0}]
 migration.skipSignatureFile=Drop cryptographic signature file [{0}]
 migration.stream=Migrating stream [{0}]
-migration.usage=Usage: Migration <source> <destination>
\ No newline at end of file
+migration.usage=Usage: Migration <source> <destination>
+migration.warnSignatureRemoval=Removed cryptographic signature from JAR file
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org