Program: 20231
Project: 20231
Buggy source:
public DeviceTicket(AppProperties props){
  PrinterWritterPool pws=new PrinterWritterPool();
  StringParser sf=new StringParser(props.getProperty("String_Node_Str"));
  String sFiscalType=sf.nextToken(':');
  String sFiscalParam1=sf.nextToken(',');
  try {
    if ("String_Node_Str".equals(sFiscalType)) {
      m_deviceFiscal=new DeviceFiscalPrinterJavaPOS(sFiscalParam1);
    }
 else {
      m_deviceFiscal=new DeviceFiscalPrinterNull();
    }
  }
 catch (  TicketPrinterException e) {
    m_deviceFiscal=new DeviceFiscalPrinterNull(e.getMessage());
  }
  StringParser sd=new StringParser(props.getProperty("String_Node_Str"));
  String sDisplayType=sd.nextToken(':');
  String sDisplayParam1=sd.nextToken(',');
  String sDisplayParam2=sd.nextToken(',');
  if ("String_Node_Str".equals(sDisplayType) || "String_Node_Str".equals(sDisplayType) || "String_Node_Str".equals(sDisplayType)) {
    sDisplayParam2=sDisplayParam1;
    sDisplayParam1=sDisplayType;
    sDisplayType="String_Node_Str";
  }
  try {
    if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayPanel();
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayWindow();
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayESCPOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2),new UnicodeTranslatorInt());
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplaySurePOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2));
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayESCPOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2),new UnicodeTranslatorEur());
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayJavaPOS(sDisplayParam1);
    }
 else {
      m_devicedisplay=new DeviceDisplayNull();
    }
  }
 catch (  TicketPrinterException e) {
    m_devicedisplay=new DeviceDisplayNull(e.getMessage());
  }
  m_nullprinter=new DevicePrinterNull();
  m_deviceprinters=new HashMap<String,DevicePrinter>();
  m_deviceprinterslist=new ArrayList<DevicePrinter>();
  int iPrinterIndex=1;
  String sPrinterIndex=Integer.toString(iPrinterIndex);
  String sprinter=props.getProperty("String_Node_Str");
  while (sprinter != null && !"String_Node_Str".equals(sprinter)) {
    StringParser sp=new StringParser(sprinter);
    String sPrinterType=sp.nextToken(':');
    String sPrinterParam1=sp.nextToken(',');
    String sPrinterParam2=sp.nextToken(',');
    if ("String_Node_Str".equals(sPrinterType) || "String_Node_Str".equals(sPrinterType) || "String_Node_Str".equals(sPrinterType)) {
      sPrinterParam2=sPrinterParam1;
      sPrinterParam1=sPrinterType;
      sPrinterType="String_Node_Str";
    }
    try {
      if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterPanel());
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterPrinter(sPrinterParam1,Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesEpson(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesTMU220(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesStar(),new UnicodeTranslatorStar()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesIthaca(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesSurePOS(),new UnicodeTranslatorSurePOS()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterPlain(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2)));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterJavaPOS(sPrinterParam1,sPrinterParam2));
      }
    }
 catch (    TicketPrinterException e) {
    }
    iPrinterIndex++;
    sPrinterIndex=Integer.toString(iPrinterIndex);
    sprinter=props.getProperty("String_Node_Str" + sPrinterIndex);
  }
}

Fixed version (ground truth):
public DeviceTicket(AppProperties props){
  PrinterWritterPool pws=new PrinterWritterPool();
  StringParser sf=new StringParser(props.getProperty("String_Node_Str"));
  String sFiscalType=sf.nextToken(':');
  String sFiscalParam1=sf.nextToken(',');
  try {
    if ("String_Node_Str".equals(sFiscalType)) {
      m_deviceFiscal=new DeviceFiscalPrinterJavaPOS(sFiscalParam1);
    }
 else {
      m_deviceFiscal=new DeviceFiscalPrinterNull();
    }
  }
 catch (  TicketPrinterException e) {
    m_deviceFiscal=new DeviceFiscalPrinterNull(e.getMessage());
  }
  StringParser sd=new StringParser(props.getProperty("String_Node_Str"));
  String sDisplayType=sd.nextToken(':');
  String sDisplayParam1=sd.nextToken(',');
  String sDisplayParam2=sd.nextToken(',');
  if ("String_Node_Str".equals(sDisplayType) || "String_Node_Str".equals(sDisplayType) || "String_Node_Str".equals(sDisplayType)) {
    sDisplayParam2=sDisplayParam1;
    sDisplayParam1=sDisplayType;
    sDisplayType="String_Node_Str";
  }
  try {
    if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayPanel();
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayWindow();
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayESCPOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2),new UnicodeTranslatorInt());
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplaySurePOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2));
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayESCPOS(pws.getPrinterWritter(sDisplayParam1,sDisplayParam2),new UnicodeTranslatorEur());
    }
 else     if ("String_Node_Str".equals(sDisplayType)) {
      m_devicedisplay=new DeviceDisplayJavaPOS(sDisplayParam1);
    }
 else {
      m_devicedisplay=new DeviceDisplayNull();
    }
  }
 catch (  TicketPrinterException e) {
    m_devicedisplay=new DeviceDisplayNull(e.getMessage());
  }
  m_nullprinter=new DevicePrinterNull();
  m_deviceprinters=new HashMap<String,DevicePrinter>();
  m_deviceprinterslist=new ArrayList<DevicePrinter>();
  int iPrinterIndex=1;
  String sPrinterIndex=Integer.toString(iPrinterIndex);
  String sprinter=props.getProperty("String_Node_Str");
  while (sprinter != null && !"String_Node_Str".equals(sprinter)) {
    StringParser sp=new StringParser(sprinter);
    String sPrinterType=sp.nextToken(':');
    String sPrinterParam1=sp.nextToken(',');
    String sPrinterParam2=sp.nextToken(',');
    if ("String_Node_Str".equals(sPrinterType) || "String_Node_Str".equals(sPrinterType) || "String_Node_Str".equals(sPrinterType)) {
      sPrinterParam2=sPrinterParam1;
      sPrinterParam1=sPrinterType;
      sPrinterType="String_Node_Str";
    }
    try {
      if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterPanel());
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        if (sPrinterParam2 == null || sPrinterParam2.equals("String_Node_Str") || sPrinterParam2.equals("String_Node_Str")) {
          sPrinterParam2="String_Node_Str";
        }
 else         if (sPrinterParam2.equals("String_Node_Str")) {
          sPrinterParam2="String_Node_Str";
        }
        addPrinter(sPrinterIndex,new DevicePrinterPrinter(sPrinterParam1,Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),Integer.parseInt(props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")),props.getProperty("String_Node_Str" + sPrinterParam2 + "String_Node_Str")));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesEpson(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesTMU220(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesStar(),new UnicodeTranslatorStar()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesIthaca(),new UnicodeTranslatorInt()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterESCPOS(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2),new CodesSurePOS(),new UnicodeTranslatorSurePOS()));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterPlain(pws.getPrinterWritter(sPrinterParam1,sPrinterParam2)));
      }
 else       if ("String_Node_Str".equals(sPrinterType)) {
        addPrinter(sPrinterIndex,new DevicePrinterJavaPOS(sPrinterParam1,sPrinterParam2));
      }
    }
 catch (    TicketPrinterException e) {
    }
    iPrinterIndex++;
    sPrinterIndex=Integer.toString(iPrinterIndex);
    sprinter=props.getProperty("String_Node_Str" + sPrinterIndex);
  }
}