JDK-7148584 : Jar tools fails to generate manifest correctly when boundary condition hit
  • Type: Bug
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 6u24
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-02-24
  • Updated: 2014-11-19
  • Resolved: 2012-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8
6u31-revFixed 7u6Fixed 8 b32Fixed
Description
SHORT SUMMARY:Jar tools fails to generate manifest file correctly when 
boundary condition hit in Manifest.FastInputStream class
INDICATORS: jar tool fails to add attributes to Manifest file
COUNTER INDICATORS:
TRIGGERS: A manifest file is supplied of unique size so that a 
Manifest.FastInputStream.fill() call is made just before EOF of Manifest file 
is reached.
KNOWN WORKAROUND: Add an extra empty line to Manifest file supplied to jar 
command
PRESENT SINCE: FCS 
HOW TO VERIFY: See bug DB descrition
NOTES FOR SE:
REGRESSION: No.

Comments
SUGGESTED FIX proposed change to fill() method in Manifest.FastInputStream : (6.0 codebase) @@ -422,7 +420,10 @@ public class Manifest implements Cloneab int n = in.read(buf, 0, buf.length); if (n > 0) { count = n; - } + } else { + //EOF reached + buf[0] = (byte)'\n'; + } }
2012-02-24

EVALUATION when EOF is encountered (and fill() read call returns -1), we should invalidate the buffer (buf) so that any peek calls doesn't read back data in the buffer from the previous fill() call.
2012-02-24