Program: 187960
Project: 187960
Buggy source:
/** 
 * {@inheritDoc}
 */
public String applyColour(Color[] palette,Color oldBackground,Color oldForeground,boolean[] oldFormat,Color newBackground,Color newForeground,boolean[] newFormat){
  StringBuilder rc=new StringBuilder();
  int colourindex1back=-1, colourindex2back=-1;
  int colourindex1fore=-1, colourindex2fore=-1;
  if ((oldBackground != null) && (newBackground == null)) {
    Color colour=palette[0]=this.palette[0];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
  }
 else   if ((oldBackground == null) || (oldBackground.equals(newBackground) == false))   if (newBackground != null) {
    if (this.fullcolour == false)     colourindex1back=matchColour(newBackground,palette,16,256,this.chroma);
    colourindex2back=this.colourful ? matchColour(this.fullcolour ? newBackground : palette[colourindex1back],this.palette,0,8,this.chroma) : 7;
  }
  if ((oldForeground != null) && (newForeground == null)) {
    Color colour=palette[7]=this.palette[7];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
  }
 else   if ((oldForeground == null) || (oldForeground.equals(newForeground) == false))   if (newForeground != null) {
    if (this.fullcolour == false)     colourindex1fore=matchColour(newForeground,palette,16,256,this.chroma);
    int s=((newFormat.length > 9) && newFormat[9]) ? 0 : (newFormat[0] ? 8 : 0);
    int e=((newFormat.length > 9) && newFormat[9]) ? 16 : (s + 8);
    colourindex2fore=this.colourful ? matchColour(this.fullcolour ? newForeground : palette[colourindex1fore],this.palette,s,e,this.chroma) : 15;
    if (((colourindex2fore == 0) && (newBackground == null)) || (colourindex2fore == colourindex2back))     colourindex2fore^=8;
  }
  if (colourindex2back != -1) {
    Color colour=palette[colourindex1back];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colourindex2back));
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
    rc.append(colourindex2back);
  }
  if (colourindex2fore != -1) {
    Color colour=palette[colourindex1fore];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colourindex2fore));
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
    rc.append(colourindex2fore & 7);
  }
  boolean _=newFormat[0];
  newFormat[0]=(colourindex2fore == -1) ? oldFormat[0] : ((8 <= colourindex2fore) && (colourindex2fore < 16));
  for (int i=0; i < 9; i++)   if (newFormat[i] ^ oldFormat[i])   if ((oldFormat[i]=newFormat[i])) {
    rc.append("String_Node_Str");
    rc.append(i + 1);
  }
 else {
    rc.append("String_Node_Str");
    rc.append(i + 1);
  }
  newFormat[0]=_;
  String _rc=rc.toString();
  if (_rc.isEmpty())   return "String_Node_Str";
  return ("String_Node_Str" + _rc.substring(1)).replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public String applyColour(Color[] palette,Color oldBackground,Color oldForeground,boolean[] oldFormat,Color newBackground,Color newForeground,boolean[] newFormat){
  StringBuilder rc=new StringBuilder();
  int colourindex1back=-1, colourindex2back=-1;
  int colourindex1fore=-1, colourindex2fore=-1;
  if ((oldBackground != null) && (newBackground == null)) {
    Color colour=palette[0]=this.palette[0];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
  }
 else   if ((oldBackground == null) || (oldBackground.equals(newBackground) == false))   if (newBackground != null) {
    if (this.fullcolour == false)     colourindex1back=matchColour(newBackground,palette,16,256,this.chroma);
    colourindex2back=this.colourful ? matchColour(this.fullcolour ? newBackground : palette[colourindex1back],this.palette,0,8,this.chroma) : 7;
  }
  if ((oldForeground != null) && (newForeground == null)) {
    Color colour=palette[7]=this.palette[7];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
  }
 else   if ((oldForeground == null) || (oldForeground.equals(newForeground) == false))   if (newForeground != null) {
    if (this.fullcolour == false)     colourindex1fore=matchColour(newForeground,palette,16,256,this.chroma);
    int s=((newFormat.length > 9) && newFormat[9]) ? 0 : (newFormat[0] ? 8 : 0);
    int e=((newFormat.length > 9) && newFormat[9]) ? 16 : (s + 8);
    colourindex2fore=this.colourful ? matchColour(this.fullcolour ? newForeground : palette[colourindex1fore],this.palette,s,e,this.chroma) : 15;
    if (((colourindex2fore == 0) && (newBackground == null)) || (colourindex2fore == colourindex2back))     colourindex2fore^=8;
  }
  if (colourindex2back != -1)   if (this.fullcolour == false) {
    Color colour=palette[colourindex1back];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colourindex2back));
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
    rc.append(colourindex2back);
  }
 else {
    rc.append("String_Node_Str");
    rc.append(colourindex2back);
  }
  if (colourindex2fore != -1)   if (this.fullcolour == false) {
    Color colour=palette[colourindex1fore];
    rc.append("String_Node_Str");
    rc.append("String_Node_Str".charAt(colourindex2fore));
    rc.append("String_Node_Str".charAt(colour.getRed() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getRed() & 15));
    rc.append("String_Node_Str".charAt(colour.getGreen() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getGreen() & 15));
    rc.append("String_Node_Str".charAt(colour.getBlue() >>> 4));
    rc.append("String_Node_Str".charAt(colour.getBlue() & 15));
    rc.append("String_Node_Str");
    rc.append(colourindex2fore & 7);
  }
 else {
    rc.append("String_Node_Str");
    rc.append(colourindex2fore & 7);
  }
  boolean _=newFormat[0];
  newFormat[0]=(colourindex2fore == -1) ? oldFormat[0] : ((8 <= colourindex2fore) && (colourindex2fore < 16));
  for (int i=0; i < 9; i++)   if (newFormat[i] ^ oldFormat[i])   if ((oldFormat[i]=newFormat[i])) {
    rc.append("String_Node_Str");
    rc.append(i + 1);
  }
 else {
    rc.append("String_Node_Str");
    rc.append(i + 1);
  }
  newFormat[0]=_;
  String _rc=rc.toString();
  if (_rc.isEmpty())   return "String_Node_Str";
  return ("String_Node_Str" + _rc.substring(1)).replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
}