Program: 20290
Project: 20290
Buggy source:
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
switch (m_iOutputType) {
case OUTPUT_NONE:
    if ("String_Node_Str".equals(qName)) {
      try {
        AudioClip oAudio=Applet.newAudioClip(getClass().getClassLoader().getResource(text.toString()));
        oAudio.play();
      }
 catch (      Exception fnfe) {
      }
      text=null;
    }
  break;
case OUTPUT_TICKET:
if ("String_Node_Str".equals(qName)) {
  try {
    BufferedImage image=m_system.getResourceAsImage(text.toString());
    m_oOutputPrinter.printImage(image);
  }
 catch (  Exception fnfe) {
  }
  text=null;
}
 else if ("String_Node_Str".equals(qName)) {
  m_oOutputPrinter.printBarCode(bctype,bcposition,text.toString());
  text=null;
}
 else if ("String_Node_Str".equals(qName)) {
  if (m_iTextLength > 0) {
switch (m_iTextAlign) {
case DevicePrinter.ALIGN_RIGHT:
      m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignRight(text.toString(),m_iTextLength));
    break;
case DevicePrinter.ALIGN_CENTER:
  m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignCenter(text.toString(),m_iTextLength));
break;
default :
m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignLeft(text.toString(),m_iTextLength));
break;
}
}
 else {
m_oOutputPrinter.printText(m_iTextStyle,text.toString());
}
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_oOutputPrinter.endLine();
}
 else if ("String_Node_Str".equals(qName)) {
m_oOutputPrinter.endReceipt();
m_iOutputType=OUTPUT_NONE;
m_oOutputPrinter=null;
}
break;
case OUTPUT_DISPLAY:
if ("String_Node_Str".equals(qName)) {
if (m_sVisorLine1 == null) {
m_sVisorLine1=m_sVisorLine.toString();
}
 else {
m_sVisorLine2=m_sVisorLine.toString();
}
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_sVisorLine1=m_sVisorLine.toString();
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_sVisorLine2=m_sVisorLine.toString();
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
if (m_iTextLength > 0) {
switch (m_iTextAlign) {
case DevicePrinter.ALIGN_RIGHT:
m_sVisorLine.append(DeviceTicket.alignRight(text.toString(),m_iTextLength));
break;
case DevicePrinter.ALIGN_CENTER:
m_sVisorLine.append(DeviceTicket.alignCenter(text.toString(),m_iTextLength));
break;
default :
m_sVisorLine.append(DeviceTicket.alignLeft(text.toString(),m_iTextLength));
break;
}
}
 else {
m_sVisorLine.append(text);
}
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getDeviceDisplay().writeVisor(m_iVisorAnimation,m_sVisorLine1,m_sVisorLine2);
m_iVisorAnimation=DeviceDisplayBase.ANIMATION_NULL;
m_sVisorLine1=null;
m_sVisorLine2=null;
m_iOutputType=OUTPUT_NONE;
m_oOutputPrinter=null;
}
break;
case OUTPUT_FISCAL:
if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().endReceipt();
m_iOutputType=OUTPUT_NONE;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printLine(text.toString(),m_dValue1,m_dValue2);
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printMessage(text.toString());
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printTotal(text.toString(),m_dValue1);
text=null;
}
break;
}
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
switch (m_iOutputType) {
case OUTPUT_NONE:
    if ("String_Node_Str".equals(qName)) {
      try {
        AudioClip oAudio=Applet.newAudioClip(getClass().getClassLoader().getResource(text.toString()));
        oAudio.play();
      }
 catch (      Exception fnfe) {
      }
      text=null;
    }
  break;
case OUTPUT_TICKET:
if ("String_Node_Str".equals(qName)) {
  try {
    BufferedImage image=m_system.getResourceAsImage(text.toString());
    m_oOutputPrinter.printImage(image);
  }
 catch (  Exception fnfe) {
  }
  text=null;
}
 else if ("String_Node_Str".equals(qName)) {
  m_oOutputPrinter.printBarCode(bctype,bcposition,text.toString());
  text=null;
}
 else if ("String_Node_Str".equals(qName)) {
  if (m_iTextLength > 0) {
switch (m_iTextAlign) {
case DevicePrinter.ALIGN_RIGHT:
      m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignRight(text.toString(),m_iTextLength));
    break;
case DevicePrinter.ALIGN_CENTER:
  m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignCenter(text.toString(),m_iTextLength));
break;
default :
m_oOutputPrinter.printText(m_iTextStyle,DeviceTicket.alignLeft(text.toString(),m_iTextLength));
break;
}
}
 else {
m_oOutputPrinter.printText(m_iTextStyle,text.toString());
}
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_oOutputPrinter.endLine();
}
 else if ("String_Node_Str".equals(qName)) {
m_oOutputPrinter.endReceipt();
m_iOutputType=OUTPUT_NONE;
m_oOutputPrinter=null;
}
break;
case OUTPUT_DISPLAY:
if ("String_Node_Str".equals(qName)) {
if (m_sVisorLine1 == null) {
m_sVisorLine1=m_sVisorLine.toString();
}
 else {
m_sVisorLine2=m_sVisorLine.toString();
}
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_sVisorLine1=m_sVisorLine.toString();
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_sVisorLine2=m_sVisorLine.toString();
m_sVisorLine=null;
}
 else if ("String_Node_Str".equals(qName)) {
if (m_iTextLength > 0) {
switch (m_iTextAlign) {
case DevicePrinter.ALIGN_RIGHT:
m_sVisorLine.append(DeviceTicket.alignRight(text.toString(),m_iTextLength));
break;
case DevicePrinter.ALIGN_CENTER:
m_sVisorLine.append(DeviceTicket.alignCenter(text.toString(),m_iTextLength));
break;
default :
m_sVisorLine.append(DeviceTicket.alignLeft(text.toString(),m_iTextLength));
break;
}
}
 else {
m_sVisorLine.append(text);
}
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getDeviceDisplay().writeVisor(m_iVisorAnimation,m_sVisorLine1,m_sVisorLine2);
m_iVisorAnimation=DeviceDisplayBase.ANIMATION_NULL;
m_sVisorLine1=null;
m_sVisorLine2=null;
m_iOutputType=OUTPUT_NONE;
m_oOutputPrinter=null;
}
break;
case OUTPUT_FISCAL:
if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().endReceipt();
m_iOutputType=OUTPUT_NONE;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printLine(text.toString(),m_dValue1,m_dValue2,attribute3);
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printMessage(text.toString());
text=null;
}
 else if ("String_Node_Str".equals(qName)) {
m_printer.getFiscalPrinter().printTotal(text.toString(),m_dValue1);
text=null;
}
break;
}
}