-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lost class files when exporting jar #916
Comments
I'm not quite sure why this is happening, but through the debugging of Idea, I roughly understand the Before: resource.jvmClassBundleStream().forEach(bundle -> {
for (JvmClassInfo classInfo : bundle) {
String key;
String originalName = PathOriginalNameProperty.get(classInfo);
if (originalName == null) {
String pathPrefix = PathPrefixProperty.get(classInfo);
String pathSuffix = Objects.requireNonNullElse(PathSuffixProperty.get(classInfo), ".class");
key = classInfo.getName() + pathSuffix;
if (pathPrefix != null)
key = pathPrefix + key;
} else {
key = originalName;
}
map.put(key, classInfo.getBytecode());
updateProperties(key, classInfo);
}
}); My Edition: resource.jvmClassBundleStream().forEach(bundle -> {
for (JvmClassInfo classInfo : bundle) {
String key;
String originalName = PathOriginalNameProperty.get(classInfo);
if (originalName == null) {
String pathPrefix = PathPrefixProperty.get(classInfo);
String pathSuffix = Objects.requireNonNullElse(PathSuffixProperty.get(classInfo), ".class");
key = classInfo.getName() + pathSuffix;
if (pathPrefix != null)
key = pathPrefix + key;
} else {
key = classInfo.getName();
}
map.put(key, classInfo.getBytecode());
updateProperties(key, classInfo);
}
}); This can fix the issue where some files cannot be written, but I am not sure if there are any side effects. |
Please provide a sample so I can step through and see if the suggested fix has any side-effects. |
Additionally, There is no inherent cut-off for content with null terminators, so I this may be a slightly different issue. |
Describe the bug
Because these classes are confused and named in the format xxx\u0000xxx.class, the characters before \u0000 are the same, and the file is only distinguished by the differences in the characters after \u0000. In this case, exporting with recaf would result in losing most of the files starting with xxx\u0000.
In the output window of recaf, it shows that the export has been successful, and the fact is that it has indeed been exported, but some class files have been discarded.
The text was updated successfully, but these errors were encountered: