Program: 34792
Project: 34792
Buggy source:
public static byte[] encodeHeader(H2HeaderTable table,String name,String value,LiteralIndexType type,boolean huffman) throws CompressionException, IOException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.entry(tc,"String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
  }
  if (table == null || !table.isDynamicTableValid()) {
    throw new CompressionException("String_Node_Str");
  }
  ByteArrayOutputStream encodedHeader=new ByteArrayOutputStream();
  String compliantName=name.toLowerCase();
  int indexLocation=0;
  H2HeaderField indexedHeader=null;
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str");
  }
  indexedHeader=table.getHeaderEntry(compliantName,value);
  if (indexedHeader != null) {
    indexLocation=indexedHeader.getCurrentIndex();
    if (indexedHeader.getValueHash() == value.hashCode()) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + indexLocation + "String_Node_Str");
      }
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.exit(tc,"String_Node_Str");
      }
      return IntegerRepresentation.encode(indexLocation,ByteFormatType.INDEXED);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + indexLocation + "String_Node_Str");
    }
  }
  encodedHeader.write(IntegerRepresentation.encode(indexLocation,type));
  if (indexLocation == 0) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str");
    }
    encodeFragment(encodedHeader,compliantName,huffman);
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str");
  }
  encodeFragment(encodedHeader,value,huffman);
  if (type == LiteralIndexType.INDEX) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str");
    }
    table.addHeaderEntry(new H2HeaderField(compliantName,value));
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.exit(tc,"String_Node_Str");
  }
  return encodedHeader.toByteArray();
}

Fixed version (ground truth):
public static byte[] encodeHeader(H2HeaderTable table,String name,String value,LiteralIndexType type,boolean huffman) throws CompressionException, IOException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.entry(tc,"String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ value);
  }
  if (table == null || !table.isDynamicTableValid()) {
    throw new CompressionException("String_Node_Str");
  }
  ByteArrayOutputStream encodedHeader=new ByteArrayOutputStream();
  String compliantName=name.toLowerCase();
  int indexLocation=0;
  H2HeaderField indexedHeader=null;
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str");
  }
  indexedHeader=table.getHeaderEntry(compliantName,value);
  if (indexedHeader != null) {
    indexLocation=indexedHeader.getCurrentIndex();
    if (indexedHeader.getValueHash() == value.hashCode()) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + indexLocation + "String_Node_Str");
      }
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.exit(tc,"String_Node_Str");
      }
      return IntegerRepresentation.encode(indexLocation,ByteFormatType.INDEXED);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + indexLocation + "String_Node_Str");
    }
  }
  encodedHeader.write(IntegerRepresentation.encode(indexLocation,type));
  if (indexLocation == 0) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str");
    }
    encodeFragment(encodedHeader,compliantName,huffman);
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str");
  }
  encodeFragment(encodedHeader,value,huffman);
  if (type == LiteralIndexType.INDEX) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str");
    }
    table.addHeaderEntry(new H2HeaderField(compliantName,value));
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.exit(tc,"String_Node_Str");
  }
  return encodedHeader.toByteArray();
}