Program: 117110
Project: 117110
Buggy source:
/** 
 * Generates the EPL2 commands to print an image. One command is emitted per line of the image. This avoids issues with too long commands.
 * @return The commands to print the image as an array of bytes, ready to besent to the printer
 */
public byte[] getImageCommand() throws InvalidRawImageException, UnsupportedEncodingException {
  this.getByteBuffer().clear();
switch (languageType) {
case ESCP:
case ESCP2:
    appendEpsonSlices(this.getByteBuffer());
  break;
case ZPL:
case ZPLII:
String zplHexAsString=ByteUtilities.getHexString(getImageAsIntArray());
int byteLen=zplHexAsString.length() / 2;
int perRow=byteLen / getHeight();
StringBuilder zpl=new StringBuilder("String_Node_Str").append(byteLen).append("String_Node_Str").append(byteLen).append("String_Node_Str").append(perRow).append("String_Node_Str").append(zplHexAsString);
this.getByteBuffer().append(zpl,charset);
break;
case EPL:
case EPL2:
StringBuilder epl=new StringBuilder("String_Node_Str").append(getxPos()).append("String_Node_Str").append(getyPos()).append("String_Node_Str").append(getWidth() / 8).append("String_Node_Str").append(getHeight()).append("String_Node_Str");
this.getByteBuffer().append(epl,charset).append(getBytes());
break;
case CPCL:
String cpclHexAsString=ByteUtilities.getHexString(getImageAsIntArray());
StringBuilder cpcl=new StringBuilder("String_Node_Str").append((int)(getWidth() / 8)).append("String_Node_Str").append(getHeight()).append("String_Node_Str").append(getxPos()).append("String_Node_Str").append(getyPos()).append("String_Node_Str").append(cpclHexAsString);
this.getByteBuffer().append(cpcl,charset);
break;
default :
throw new InvalidRawImageException(charset.name() + "String_Node_Str");
}
return this.getByteBuffer().getByteArray();
}

Fixed version (ground truth):
/** 
 * Generates the EPL2 commands to print an image. One command is emitted per line of the image. This avoids issues with too long commands.
 * @return The commands to print the image as an array of bytes, ready to besent to the printer
 */
public byte[] getImageCommand() throws InvalidRawImageException, UnsupportedEncodingException {
  this.getByteBuffer().clear();
switch (languageType) {
case ESCP:
case ESCP2:
    appendEpsonSlices(this.getByteBuffer());
  break;
case ZPL:
case ZPLII:
String zplHexAsString=ByteUtilities.getHexString(getImageAsIntArray());
int byteLen=zplHexAsString.length() / 2;
int perRow=byteLen / getHeight();
StringBuilder zpl=new StringBuilder("String_Node_Str").append(byteLen).append("String_Node_Str").append(byteLen).append("String_Node_Str").append(perRow).append("String_Node_Str").append(zplHexAsString);
this.getByteBuffer().append(zpl,charset);
break;
case EPL:
case EPL2:
StringBuilder epl=new StringBuilder("String_Node_Str").append(getxPos()).append("String_Node_Str").append(getyPos()).append("String_Node_Str").append(getWidth() / 8).append("String_Node_Str").append(getHeight()).append("String_Node_Str");
this.getByteBuffer().append(epl,charset).append(getBytes());
break;
case CPCL:
String cpclHexAsString=ByteUtilities.getHexString(getImageAsIntArray());
StringBuilder cpcl=new StringBuilder("String_Node_Str").append(getWidth() / 8).append("String_Node_Str").append(getHeight()).append("String_Node_Str").append(getxPos()).append("String_Node_Str").append(getyPos()).append("String_Node_Str").append(cpclHexAsString);
this.getByteBuffer().append(cpcl,charset);
break;
default :
throw new InvalidRawImageException(charset.name() + "String_Node_Str");
}
return this.getByteBuffer().getByteArray();
}