Buggy code:
public class ZipOutputStream extends DeflaterOutputStream { private ZipEntry entry ; private String comment = "" ; private int level = Deflater . DEFAULT_COMPRESSION ; private boolean hasCompressionLevelChanged = false ; private int method = ZipOutputStream . DEFLATED ; private Vector entries = new Vector ( ) ; private CRC32 crc = new CRC32 ( ) ; private long written = 0 ; private long dataStart = 0 ; private ZipLong cdOffset = new ZipLong ( 0 ) ; private ZipLong cdLength = new ZipLong ( 0 ) ; private static final byte [ ] ZERO = new byte [ ] { 0 , 0 } ; private static final byte [ ] LZERO = new byte [ ] { 0 , 0 , 0 , 0 } ; private Hashtable offsets = new Hashtable ( ) ; private String encoding = null ; public static final int DEFLATED = ZipEntry . DEFLATED ; public static final int STORED = ZipEntry . STORED ; public ZipOutputStream ( OutputStream out ) { } public void setEncoding ( String encoding ) { } public String getEncoding ( ) { } public void finish ( ) throws IOException { } public void closeEntry ( ) throws IOException { } public void putNextEntry ( ZipEntry ze ) throws IOException { } public void setComment ( String comment ) { } public void setLevel ( int level ) { } public void setMethod ( int method ) { } public void write ( byte [ ] b , int offset , int length ) throws IOException { } protected static final ZipLong LFH_SIG = new ZipLong ( 67324752L ) ; protected static final ZipLong DD_SIG = new ZipLong ( 134695760L ) ; protected static final ZipLong CFH_SIG = new ZipLong ( 33639248L ) ; protected static final ZipLong EOCD_SIG = new ZipLong ( 101010256L ) ; protected void writeLocalFileHeader ( ZipEntry ze ) throws IOException { } protected void writeDataDescriptor ( ZipEntry ze ) throws IOException { } protected void writeCentralFileHeader ( ZipEntry ze ) throws IOException { out . write ( ZipOutputStream . CFH_SIG . getBytes ( ) ) ; written += 4 ; <START_BUG> out . write ( new ZipShort ( 20 ) . getBytes ( ) ) ; <END_BUG> written += 2 ; if ( ( ze . getMethod ( ) ) == ( ZipOutputStream . DEFLATED ) ) { out . write ( new ZipShort ( 20 ) . getBytes ( ) ) ; out . write ( new ZipShort ( 8 ) . getBytes ( ) ) ; } else { out . write ( new ZipShort ( 10 ) . getBytes ( ) ) ; out . write ( ZipOutputStream . ZERO ) ; } written += 4 ; out . write ( new ZipShort ( ze . getMethod ( ) ) . getBytes ( ) ) ; written += 2 ; out . write ( ZipOutputStream . toDosTime ( new Date ( ze . getTime ( ) ) ) . getBytes ( ) ) ; written += 4 ; out . write ( new ZipLong ( ze . getCrc ( ) ) . getBytes ( ) ) ; out . write ( new ZipLong ( ze . getCompressedSize ( ) ) . getBytes ( ) ) ; out . write ( new ZipLong ( ze . getSize ( ) ) . getBytes ( ) ) ; written += 12 ; byte [ ] name = getBytes ( ze . getName ( ) ) ; out . write ( new ZipShort ( name . length ) . getBytes ( ) ) ; written += 2 ; byte [ ] extra = ze . getCentralDirectoryExtra ( ) ; out . write ( new ZipShort ( extra . length ) . getBytes ( ) ) ; written += 2 ; String comm = ze . getComment ( ) ; if ( comm == null ) { comm = "" ; } byte [ ] comment = getBytes ( comm ) ; out . write ( new ZipShort ( comment . length ) . getBytes ( ) ) ; written += 2 ; out . write ( ZipOutputStream . ZERO ) ; written += 2 ; out . write ( new ZipShort ( ze . getInternalAttributes ( ) ) . getBytes ( ) ) ; written += 2 ; out . write ( new ZipLong ( ze . getExternalAttributes ( ) ) . getBytes ( ) ) ; written += 4 ; out . write ( ( ( ZipLong ) ( offsets . get ( ze ) ) ) . getBytes ( ) ) ; written += 4 ; out . write ( name ) ; written += name . length ; out . write ( extra ) ; written += extra . length ; out . write ( comment ) ; written += comment . length ; } protected void writeCentralDirectoryEnd ( ) throws IOException { } private static final ZipLong DOS_TIME_MIN = new ZipLong ( 8448L ) ; protected static ZipLong toDosTime ( Date time ) { } protected byte [ ] getBytes ( String name ) throws ZipException { } }

Fix:
out . write ( new ZipShort ( ( ( ( ze . getPlatform ( ) ) << 8 ) | 20 ) ) . getBytes ( ) ) ;