Buggy code:
private static final byte ARCS_AS_FIXED_ARRAY = FST . BIT_ARC_HAS_FINAL_OUTPUT ; static final int FIXED_ARRAY_SHALLOW_DISTANCE = 3 ; static final int FIXED_ARRAY_NUM_ARCS_SHALLOW = 5 ; static final int FIXED_ARRAY_NUM_ARCS_DEEP = 10 ; private int [ ] bytesPerArc = new int [ 0 ] ; private static final String FILE_FORMAT_NAME = "FST" ; private static final int VERSION_START = 0 ; private static final int VERSION_INT_NUM_BYTES_PER_ARC = 1 ; private static final int VERSION_SHORT_BYTE2_LABELS = 2 ; private static final int VERSION_PACKED = 3 ; private static final int VERSION_CURRENT = FST . VERSION_PACKED ; private static final int FINAL_END_NODE = - 1 ; private static final int NON_FINAL_END_NODE = 0 ; T emptyOutput ; byte [ ] bytes ; int byteUpto = 0 ; private int startNode = - 1 ; public final Outputs < T > outputs ; private int lastFrozenNode ; private final T NO_OUTPUT ; public int nodeCount ; public int arcCount ; public int arcWithOutputCount ; private final boolean packed ; private Reader nodeRefToAddress ; public static final int END_LABEL = - 1 ; private boolean allowArrayArcs = true ; private FST . Arc < T > [ ] cachedRootArcs ; public static final class Arc < T > { public int label ; public T output ; int node ; public int target ; byte flags ; public T nextFinalOutput ; int nextArc ; int posArcsStart ; int bytesPerArc ; int arcIdx ; int numArcs ; public FST . Arc < T > copyFrom ( FST . Arc < T > other ) { } boolean flag ( int flag ) { } public boolean isLast ( ) { } public boolean isFinal ( ) { } @ Override public String toString ( ) { } } private static boolean flag ( int flags , int bit ) { } private final FST . BytesWriter writer ; private GrowableWriter nodeAddress ; private GrowableWriter inCounts ; FST ( FST . INPUT_TYPE inputType , Outputs < T > outputs , boolean willPackFST , float acceptableOverheadRatio ) { } public FST ( DataInput in , Outputs < T > outputs ) throws IOException { } public FST . INPUT_TYPE getInputType ( ) { } public int sizeInBytes ( ) { } void finish ( int startNode ) throws IOException { } private int getNodeAddress ( int node ) { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private void cacheRootArcs ( ) throws IOException { } public T getEmptyOutput ( ) { } void setEmptyOutput ( T v ) throws IOException { } public void save ( DataOutput out ) throws IOException { if ( ( startNode ) == ( - 1 ) ) { throw new IllegalStateException ( "call<seq2seq4repair_space>finish<seq2seq4repair_space>first" ) ; } if ( ( nodeAddress ) != null ) { throw new IllegalStateException ( "cannot<seq2seq4repair_space>save<seq2seq4repair_space>an<seq2seq4repair_space>FST<seq2seq4repair_space>pre-packed<seq2seq4repair_space>FST;<seq2seq4repair_space>it<seq2seq4repair_space>must<seq2seq4repair_space>first<seq2seq4repair_space>be<seq2seq4repair_space>packed" ) ; } if ( ( packed ) && ( ! ( ( nodeRefToAddress ) instanceof PackedInts . Mutable ) ) ) { throw new IllegalStateException ( "cannot<seq2seq4repair_space>save<seq2seq4repair_space>a<seq2seq4repair_space>FST<seq2seq4repair_space>which<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>loaded<seq2seq4repair_space>from<seq2seq4repair_space>disk<seq2seq4repair_space>" ) ; } CodecUtil . writeHeader ( out , FST . FILE_FORMAT_NAME , FST . VERSION_CURRENT ) ; if ( packed ) { out . writeByte ( ( ( byte ) ( 1 ) ) ) ; } else { out . writeByte ( ( ( byte ) ( 0 ) ) ) ; } if ( ( emptyOutput ) != null ) { out . writeByte ( ( ( byte ) ( 1 ) ) ) ; RAMOutputStream ros = new RAMOutputStream ( ) ; outputs . writeFinalOutput ( emptyOutput , ros ) ; byte [ ] emptyOutputBytes = new byte [ ( ( int ) ( ros . getFilePointer ( ) ) ) ] ; ros . writeTo ( emptyOutputBytes , 0 ) ; <START_BUG> if ( true || ( ! ( packed ) ) ) { <END_BUG> final int stopAt = ( emptyOutputBytes . length ) // 2 ; int upto = 0 ; while ( upto < stopAt ) { final byte b = emptyOutputBytes [ upto ] ; emptyOutputBytes [ upto ] = emptyOutputBytes [ ( ( ( emptyOutputBytes . length ) - upto ) - 1 ) ] ; emptyOutputBytes [ ( ( ( emptyOutputBytes . length ) - upto ) - 1 ) ] = b ; upto ++ ; } } out . writeVInt ( emptyOutputBytes . length ) ; out . writeBytes ( emptyOutputBytes , 0 , emptyOutputBytes . length ) ; } else { out . writeByte ( ( ( byte ) ( 0 ) ) ) ; } final byte t ; if ( ( inputType ) == ( FST . INPUT_TYPE . BYTE1 ) ) { t = 0 ; } else if ( ( inputType ) == ( FST . INPUT_TYPE . BYTE2 ) ) { t = 1 ; } else { t = 2 ; } out . writeByte ( t ) ; if ( packed ) { ( ( PackedInts . Mutable ) ( nodeRefToAddress ) ) . save ( out ) ; } out . writeVInt ( startNode ) ; out . writeVInt ( nodeCount ) ; out . writeVInt ( arcCount ) ; out . writeVInt ( arcWithOutputCount ) ; out . writeVInt ( bytes . length ) ; out . writeBytes ( bytes , 0 , bytes . length ) ; } public void save ( final File file ) throws IOException { } public static < T > FST < T > read ( File file , Outputs < T > outputs ) throws IOException { } private void writeLabel ( int v ) throws IOException { } int readLabel ( DataInput in ) throws IOException { } public static < T > boolean targetHasArcs ( FST . Arc < T > arc ) { } int addNode ( Builder . UnCompiledNode < T > nodeIn ) throws IOException { } public FST . Arc < T > getFirstArc ( FST . Arc < T > arc ) { }

Fix:
if ( ! ( packed ) ) {