Program: 20264
Project: 20264
Buggy source:
public boolean initApp(AppProperties props){
  m_props=props;
  applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
  try {
    session=AppViewConnection.createSession(m_props);
  }
 catch (  BasicException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,e.getMessage(),e));
    return false;
  }
  m_dlSystem=(DataLogicSystem)getBean("String_Node_Str");
  String sDBVersion=readDataBaseVersion();
  if (!AppLocal.APP_VERSION.equals(sDBVersion)) {
    String sScript=sDBVersion == null ? m_dlSystem.getInitScript() + "String_Node_Str" : m_dlSystem.getInitScript() + "String_Node_Str" + sDBVersion+ "String_Node_Str";
    if (JRootApp.class.getResource(sScript) == null) {
      JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,sDBVersion == null ? AppLocal.getIntString("String_Node_Str",session.DB.getName()) : AppLocal.getIntString("String_Node_Str")));
      session.close();
      return false;
    }
 else {
      if (JOptionPane.showConfirmDialog(this,AppLocal.getIntString(sDBVersion == null ? "String_Node_Str" : "String_Node_Str"),AppLocal.getIntString("String_Node_Str"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
        try {
          BatchSentence bsentence=new BatchSentenceResource(session,sScript);
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_ID));
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_NAME));
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_VERSION));
          java.util.List l=bsentence.list();
          if (l.size() > 0) {
            JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),l.toArray(new Throwable[l.size()])));
          }
        }
 catch (        BasicException e) {
          JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,AppLocal.getIntString("String_Node_Str"),e));
          session.close();
          return false;
        }
      }
 else {
        session.close();
        return false;
      }
    }
  }
  m_propsdb=m_dlSystem.getResourceAsProperties(m_props.getHost() + "String_Node_Str");
  try {
    String sActiveCashIndex=m_propsdb.getProperty("String_Node_Str");
    Object[] valcash=sActiveCashIndex == null ? null : m_dlSystem.findActiveCash(sActiveCashIndex);
    if (valcash == null || !m_props.getHost().equals(valcash[0])) {
      setActiveCash(UUID.randomUUID().toString(),1,new Date(),null);
      m_dlSystem.execInsertCash(new Object[]{getActiveCashIndex(),m_props.getHost(),getActiveCashSequence(),getActiveCashDateStart(),getActiveCashDateEnd()});
    }
 else {
      setActiveCash(sActiveCashIndex,(Integer)valcash[1],(Date)valcash[2],(Date)valcash[3]);
    }
  }
 catch (  BasicException e) {
    MessageInf msg=new MessageInf(MessageInf.SGN_NOTICE,AppLocal.getIntString("String_Node_Str"),e);
    msg.show(this);
    session.close();
    return false;
  }
  m_sInventoryLocation=m_propsdb.getProperty("String_Node_Str");
  if (m_sInventoryLocation == null) {
    m_sInventoryLocation="String_Node_Str";
    m_propsdb.setProperty("String_Node_Str",m_sInventoryLocation);
    m_dlSystem.setResourceAsProperties(m_props.getHost() + "String_Node_Str",m_propsdb);
  }
  m_TP=new DeviceTicket(m_props);
  m_TTP=new TicketParser(getDeviceTicket(),m_dlSystem);
  printerStart();
  m_Scale=new DeviceScale(m_props);
  m_Scanner=DeviceScannerFactory.createInstance(m_props);
  BufferedImage imgicon=m_dlSystem.getResourceAsImage("String_Node_Str");
  m_jLblTitle.setIcon(imgicon == null ? null : new ImageIcon(imgicon));
  m_jLblTitle.setText(m_dlSystem.getResourceAsText("String_Node_Str"));
  String sWareHouse;
  try {
    sWareHouse=m_dlSystem.findLocationName(m_sInventoryLocation);
  }
 catch (  BasicException e) {
    sWareHouse=null;
  }
  String url;
  try {
    url=session.getURL();
  }
 catch (  SQLException e) {
    url="String_Node_Str";
  }
  m_jHost.setText("String_Node_Str" + m_props.getHost() + "String_Node_Str"+ sWareHouse+ "String_Node_Str"+ url);
  showLogin();
  return true;
}

Fixed version (ground truth):
public boolean initApp(AppProperties props){
  m_props=props;
  applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
  try {
    session=AppViewConnection.createSession(m_props);
  }
 catch (  BasicException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,e.getMessage(),e));
    return false;
  }
  m_dlSystem=(DataLogicSystem)getBean("String_Node_Str");
  String sDBVersion=readDataBaseVersion();
  if (!AppLocal.APP_VERSION.equals(sDBVersion)) {
    String sScript=sDBVersion == null ? m_dlSystem.getInitScript() + "String_Node_Str" : m_dlSystem.getInitScript() + "String_Node_Str" + sDBVersion+ "String_Node_Str";
    if (JRootApp.class.getResource(sScript) == null) {
      JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,sDBVersion == null ? AppLocal.getIntString("String_Node_Str",session.DB.getName()) : AppLocal.getIntString("String_Node_Str")));
      session.close();
      return false;
    }
 else {
      if (JOptionPane.showConfirmDialog(this,AppLocal.getIntString(sDBVersion == null ? "String_Node_Str" : "String_Node_Str"),AppLocal.getIntString("String_Node_Str"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
        try {
          BatchSentence bsentence=new BatchSentenceResource(session,sScript);
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_ID));
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_NAME));
          bsentence.putParameter("String_Node_Str",Matcher.quoteReplacement(AppLocal.APP_VERSION));
          java.util.List l=bsentence.list();
          if (l.size() > 0) {
            JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),l.toArray(new Throwable[l.size()])));
          }
        }
 catch (        BasicException e) {
          JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_DANGER,AppLocal.getIntString("String_Node_Str"),e));
          session.close();
          return false;
        }
      }
 else {
        session.close();
        return false;
      }
    }
  }
  m_propsdb=m_dlSystem.getResourceAsProperties(m_props.getHost() + "String_Node_Str");
  try {
    String sActiveCashIndex=m_propsdb.getProperty("String_Node_Str");
    Object[] valcash=sActiveCashIndex == null ? null : m_dlSystem.findActiveCash(sActiveCashIndex);
    if (valcash == null || !m_props.getHost().equals(valcash[0])) {
      setActiveCash(UUID.randomUUID().toString(),m_dlSystem.getSequenceCash(m_props.getHost()) + 1,new Date(),null);
      m_dlSystem.execInsertCash(new Object[]{getActiveCashIndex(),m_props.getHost(),getActiveCashSequence(),getActiveCashDateStart(),getActiveCashDateEnd()});
    }
 else {
      setActiveCash(sActiveCashIndex,(Integer)valcash[1],(Date)valcash[2],(Date)valcash[3]);
    }
  }
 catch (  BasicException e) {
    MessageInf msg=new MessageInf(MessageInf.SGN_NOTICE,AppLocal.getIntString("String_Node_Str"),e);
    msg.show(this);
    session.close();
    return false;
  }
  m_sInventoryLocation=m_propsdb.getProperty("String_Node_Str");
  if (m_sInventoryLocation == null) {
    m_sInventoryLocation="String_Node_Str";
    m_propsdb.setProperty("String_Node_Str",m_sInventoryLocation);
    m_dlSystem.setResourceAsProperties(m_props.getHost() + "String_Node_Str",m_propsdb);
  }
  m_TP=new DeviceTicket(m_props);
  m_TTP=new TicketParser(getDeviceTicket(),m_dlSystem);
  printerStart();
  m_Scale=new DeviceScale(m_props);
  m_Scanner=DeviceScannerFactory.createInstance(m_props);
  BufferedImage imgicon=m_dlSystem.getResourceAsImage("String_Node_Str");
  m_jLblTitle.setIcon(imgicon == null ? null : new ImageIcon(imgicon));
  m_jLblTitle.setText(m_dlSystem.getResourceAsText("String_Node_Str"));
  String sWareHouse;
  try {
    sWareHouse=m_dlSystem.findLocationName(m_sInventoryLocation);
  }
 catch (  BasicException e) {
    sWareHouse=null;
  }
  String url;
  try {
    url=session.getURL();
  }
 catch (  SQLException e) {
    url="String_Node_Str";
  }
  m_jHost.setText("String_Node_Str" + m_props.getHost() + "String_Node_Str"+ sWareHouse+ "String_Node_Str"+ url);
  showLogin();
  return true;
}