EVALUATION
Regression introduced by 6543940.
That fix tries to copy the raw header bytes from the old manifest to the new one. When there's no header, it regards the first jar entry section as it. I've fixed the codes to recognize the empty header, which is defined as the bytes before the first empty line. An empty line can be recognized as two consecutive \r\n, or, \r\n at the beginning.
|
EVALUATION
I've taken a look at the jar file. The problem is that it includes an illegal MANIFEST.MF with only "\r\n" inside, and then bad things happened:
1. jarsigner reads it, thinks it already has a manifest, so hasn't created a new Manifest-Main-Attributes for it.
2. when trying to write the entries to the manifest file one by one, jarsigner *removes the first one*, which it believes is the Manifest-Main-Attributes and uses the remaining parts as named sections for jar entries. Unfortunately, the first one is a jar entry, which later doesn't get signed.
Although the problem is due to the illegal MANIFEST.MF, jarsigner can be enhanced to be more robust.
|