Github user chtyim commented on a diff in the pull request:
https://github.com/apache/twill/pull/1#discussion_r75149838
--- Diff:
twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java ---
@@ -215,8 +215,19 @@ public boolean accept(String className, URL classUrl,
URL classPathUrl) {
private void putEntry(String className, URL classUrl, URL classPathUrl,
Set<String> entries, JarOutputStream jarOut) {
String classPath = classPathUrl.getFile();
if (classPath.endsWith(".jar")) {
+ String entryName = classPath.substring(classPath.lastIndexOf('/') +
1);
+ // need unique name or else we lose classes (TWILL-181)
+ if (entries.contains(SUBDIR_LIB + entryName)) {
+ String[] parts = classPath.split("/");
--- End diff --
I don't quite understand this part of the logic. Is it trying to use some
parent directory name as the entryName? Seems like it would lost the original
name. Also, if the jar is already at the root directory, then it will be using
the original "entryName", which would still result in name conflict? I would
suggest simply use package name (derived from `className`) and a random uuid to
make it unique if there is conflict. Something like:
```java
String entryName = classPath.substring(classPath.lastIndexOf('/') + 1);
if (entries.contains(SUBDIR_LIB + entryName)) {
entryName = entryName.substring(0, entryName.lastIndexOf('.')) + "-" +
className.substring(0, className.lastIndexOf('.')) + "-" + UUID.randomUUID() +
".jar";
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---