This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
The following commit(s) were added to refs/heads/master by this push:
new c05cc61 Fix warning
c05cc61 is described below
commit c05cc614f4e5942b264309f110eb3a8e0bbc7134
Author: remm <[email protected]>
AuthorDate: Tue Sep 22 09:30:53 2020 +0200
Fix warning
---
.../org/apache/tomcat/jakartaee/MigrationTest.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
index 418b57f..0e0ba2a 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
@@ -157,11 +157,12 @@ public class MigrationTest {
assertEquals("jakarta.servlet.CommonGatewayInterface",
cls.getSuperclass().getName());
// check the modification of the Implementation-Version manifest
attribute
- JarFile jar = new JarFile(jarFile);
- String implementationVersion =
jar.getManifest().getMainAttributes().getValue("Implementation-Version");
- assertNotNull("Missing Implementation-Version manifest attribute",
implementationVersion);
- assertNotEquals("Implementation-Version manifest attribute not
changed", "1.2.3", implementationVersion);
- assertTrue("Implementation-Version manifest attribute doesn't match
the expected pattern",
implementationVersion.matches("1\\.2\\.3-migrated-[\\d\\.]+.*"));
+ try (JarFile jar = new JarFile(jarFile)) {
+ String implementationVersion =
jar.getManifest().getMainAttributes().getValue("Implementation-Version");
+ assertNotNull("Missing Implementation-Version manifest attribute",
implementationVersion);
+ assertNotEquals("Implementation-Version manifest attribute not
changed", "1.2.3", implementationVersion);
+ assertTrue("Implementation-Version manifest attribute doesn't
match the expected pattern",
implementationVersion.matches("1\\.2\\.3-migrated-[\\d\\.]+.*"));
+ }
}
@Test
@@ -187,9 +188,10 @@ public class MigrationTest {
migration.setDestination(jarFile);
migration.execute();
- JarFile jar = new JarFile(jarFile);
- assertNull("Digest not removed from the manifest",
jar.getManifest().getAttributes("org/apache/tomcat/jakartaee/HelloCGI.class"));
- assertNull("Signature key not removed", jar.getEntry("META-INF/" +
algorithm.toUpperCase() + "." + algorithm.toUpperCase()));
- assertNull("Signed manifest not removed", jar.getEntry("META-INF/" +
algorithm.toUpperCase() + ".SF"));
+ try (JarFile jar = new JarFile(jarFile)) {
+ assertNull("Digest not removed from the manifest",
jar.getManifest().getAttributes("org/apache/tomcat/jakartaee/HelloCGI.class"));
+ assertNull("Signature key not removed", jar.getEntry("META-INF/" +
algorithm.toUpperCase() + "." + algorithm.toUpperCase()));
+ assertNull("Signed manifest not removed", jar.getEntry("META-INF/"
+ algorithm.toUpperCase() + ".SF"));
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]