• R/O
  • SSH
  • HTTPS

exewrap: Commit


Commit MetaInfo

Revision56 (tree)
Time2018-06-29 20:02:19
Authorhirukawa_ryo

Log Message

* exewrap 1.2.6+
Jarファイル内のエントリーが重複している場合、日付のもっとも新しいものだけを取り込むようにしました。

Change Summary

Incremental Difference

--- exewrap/trunk/exewrap/src/java/exewrap/tool/JarProcessor.java (revision 55)
+++ exewrap/trunk/exewrap/src/java/exewrap/tool/JarProcessor.java (revision 56)
@@ -8,6 +8,8 @@
88 import java.util.jar.JarInputStream;
99 import java.util.jar.JarOutputStream;
1010 import java.util.jar.Manifest;
11+import java.util.HashMap;
12+import java.util.Map;
1113 import java.util.jar.Attributes.Name;
1214 import java.util.zip.CRC32;
1315 import java.util.zip.GZIPOutputStream;
@@ -52,22 +54,42 @@
5254 jarOut.setMethod(method);
5355
5456 JarEntry entryIn;
57+ Map<String, Long> entries = new HashMap<String, Long>();
5558 while((entryIn = jarIn.getNextJarEntry()) != null) {
5659 if(!isManifest(entryIn)) {
60+ String name = entryIn.getName();
61+ Long time = entries.get(name);
62+ if(time == null || entryIn.getTime() > time.longValue()) {
63+ entries.put(name, entryIn.getTime());
64+ }
65+ }
66+ jarIn.closeEntry();
67+ }
68+ jarIn.close();
69+ jarIn = getJarInputStream(buf);
70+ while((entryIn = jarIn.getNextJarEntry()) != null) {
71+ if(!isManifest(entryIn)) {
5772 byte[] data = getBytes(jarIn);
5873 if(splashScreenName != null && entryIn.getName().equals(splashScreenName)) {
5974 splashScreenImage = data;
6075 } else {
61- JarEntry entryOut = new JarEntry(entryIn.getName());
62- entryOut.setMethod(method);
63- if(method == JarEntry.STORED) {
64- entryOut.setSize(data.length);
65- entryOut.setCrc(getCrc(data));
76+ String name = entryIn.getName();
77+ Long time = entries.get(name);
78+ if(time != null && entryIn.getTime() == time.longValue()) {
79+ JarEntry entryOut = new JarEntry(entryIn.getName());
80+ entryOut.setMethod(method);
81+ if(method == JarEntry.STORED) {
82+ entryOut.setSize(data.length);
83+ entryOut.setCrc(getCrc(data));
84+ }
85+ jarOut.putNextEntry(entryOut);
86+ jarOut.write(data);
87+ jarOut.flush();
88+ jarOut.closeEntry();
89+ entries.remove(name);
90+ } else {
91+ System.err.println("WARNING: duplicate entry: " + entryIn.getName());
6692 }
67- jarOut.putNextEntry(entryOut);
68- jarOut.write(data);
69- jarOut.flush();
70- jarOut.closeEntry();
7193 }
7294 }
7395 jarIn.closeEntry();
--- exewrap/trunk/exewrap/src/exewrap.c (revision 55)
+++ exewrap/trunk/exewrap/src/exewrap.c (revision 56)
@@ -84,7 +84,7 @@
8484 exe_file = argv[0];
8585 }
8686
87- printf("exewrap 1.2.6 for %s (%d-bit) \r\n"
87+ printf("exewrap 1.2.7 for %s (%d-bit) \r\n"
8888 "Native executable java application wrapper.\r\n"
8989 "Copyright (C) 2005-2018 HIRUKAWA Ryo. All rights reserved.\r\n"
9090 "\r\n"
Show on old repository browser