Buggy code:
public class TarArchiveOutputStream extends ArchiveOutputStream { public static final int LONGFILE_ERROR = 0 ; public static final int LONGFILE_TRUNCATE = 1 ; public static final int LONGFILE_GNU = 2 ; public static final int LONGFILE_POSIX = 3 ; public static final int BIGNUMBER_ERROR = 0 ; public static final int BIGNUMBER_STAR = 1 ; public static final int BIGNUMBER_POSIX = 2 ; private long currSize ; private String currName ; private long currBytes ; private final byte [ ] recordBuf ; private int assemLen ; private final byte [ ] assemBuf ; private int longFileMode = TarArchiveOutputStream . LONGFILE_ERROR ; private int bigNumberMode = TarArchiveOutputStream . BIGNUMBER_ERROR ; private int recordsWritten ; private final int recordsPerBlock ; private final int recordSize ; private boolean closed = false ; private boolean haveUnclosedEntry = false ; private boolean finished = false ; private final OutputStream out ; private final ZipEncoding encoding ; private boolean addPaxHeadersForNonAsciiNames = false ; private static final ZipEncoding ASCII = ZipEncodingHelper . getZipEncoding ( "ASCII" ) ; public TarArchiveOutputStream ( OutputStream os ) { } public TarArchiveOutputStream ( OutputStream os , String encoding ) { } public TarArchiveOutputStream ( OutputStream os , int blockSize ) { } public TarArchiveOutputStream ( OutputStream os , int blockSize , String encoding ) { } public TarArchiveOutputStream ( OutputStream os , int blockSize , int recordSize ) { } public TarArchiveOutputStream ( OutputStream os , int blockSize , int recordSize , String encoding ) { } public void setLongFileMode ( int longFileMode ) { } public void setBigNumberMode ( int bigNumberMode ) { } public void setAddPaxHeadersForNonAsciiNames ( boolean b ) { } @ Deprecated @ Override public int getCount ( ) { } @ Override public long getBytesWritten ( ) { } @ Override public void finish ( ) throws IOException { } @ Override public void close ( ) throws IOException { } public int getRecordSize ( ) { } @ Override public void putArchiveEntry ( ArchiveEntry archiveEntry ) throws IOException { if ( finished ) { throw new IOException ( "Stream<seq2seq4repair_space>has<seq2seq4repair_space>already<seq2seq4repair_space>been<seq2seq4repair_space>finished" ) ; } TarArchiveEntry entry = ( ( TarArchiveEntry ) ( archiveEntry ) ) ; Map < String , String > paxHeaders = new HashMap < String , String > ( ) ; final String entryName = entry . getName ( ) ; boolean paxHeaderContainsPath = handleLongName ( entryName , paxHeaders , "path" , LF_GNUTYPE_LONGNAME ) ; final String linkName = entry . getLinkName ( ) ; <START_BUG> boolean paxHeaderContainsLinkPath = ( linkName != null ) && ( handleLongName ( linkName , paxHeaders , "linkpath" , LF_GNUTYPE_LONGLINK ) ) ; <END_BUG> if ( ( bigNumberMode ) == ( TarArchiveOutputStream . BIGNUMBER_POSIX ) ) { addPaxHeadersForBigNumbers ( paxHeaders , entry ) ; } else if ( ( bigNumberMode ) != ( TarArchiveOutputStream . BIGNUMBER_STAR ) ) { failForBigNumbers ( entry ) ; } if ( ( ( addPaxHeadersForNonAsciiNames ) && ( ! paxHeaderContainsPath ) ) && ( ! ( TarArchiveOutputStream . ASCII . canEncode ( entryName ) ) ) ) { paxHeaders . put ( "path" , entryName ) ; } if ( ( ( ( addPaxHeadersForNonAsciiNames ) && ( ! paxHeaderContainsLinkPath ) ) && ( ( entry . isLink ( ) ) || ( entry . isSymbolicLink ( ) ) ) ) && ( ! ( TarArchiveOutputStream . ASCII . canEncode ( linkName ) ) ) ) { paxHeaders . put ( "linkpath" , linkName ) ; } if ( ( paxHeaders . size ( ) ) > 0 ) { writePaxHeaders ( entryName , paxHeaders ) ; } entry . writeEntryHeader ( recordBuf , encoding , ( ( bigNumberMode ) == ( TarArchiveOutputStream . BIGNUMBER_STAR ) ) ) ; writeRecord ( recordBuf ) ; currBytes = 0 ; if ( entry . isDirectory ( ) ) { currSize = 0 ; } else { currSize = entry . getSize ( ) ; } currName = entryName ; haveUnclosedEntry = true ; } @ Override public void closeArchiveEntry ( ) throws IOException { } @ Override public void write ( byte [ ] wBuf , int wOffset , int numToWrite ) throws IOException { } void writePaxHeaders ( String entryName , Map < String , String > headers ) throws IOException { } private String stripTo7Bits ( String name ) { } private void writeEOFRecord ( ) throws IOException { } @ Override public void flush ( ) throws IOException { } @ Override public ArchiveEntry createArchiveEntry ( File inputFile , String entryName ) throws IOException { } private void writeRecord ( byte [ ] record ) throws IOException { } private void writeRecord ( byte [ ] buf , int offset ) throws IOException { } private void padAsNeeded ( ) throws IOException { } private void addPaxHeadersForBigNumbers ( Map < String , String > paxHeaders , TarArchiveEntry entry ) { } private void addPaxHeaderForBigNumber ( Map < String , String > paxHeaders , String header , long value , long maxValue ) { } private void failForBigNumbers ( TarArchiveEntry entry ) { } private void failForBigNumber ( String field , long value , long maxValue ) { } private boolean handleLongName ( String name , Map < String , String > paxHeaders , String paxHeaderName , byte linkType ) throws IOException { } }

Fix:
boolean paxHeaderContainsLinkPath = ( ( linkName != null ) && ( ( linkName . length ( ) ) > 0 ) ) && ( handleLongName ( linkName , paxHeaders , "linkpath" , LF_GNUTYPE_LONGLINK ) ) ;