Program: 53270
Project: 53270
Buggy source:
/** 
 * Generate AARQ request.  Because all meters can't read all data in one packet,  the packet must be split first, by using SplitDataToPackets method.
 * @param Tags
 * @return AARQ request as byte array.
 * @see GXDLMSClient#parseAAREResponse     
 * @see GXDLMSClient#isDLMSPacketComplete
 */
public final byte[][] AARQRequest(GXDLMSTagCollection Tags){
  java.nio.ByteBuffer buff=java.nio.ByteBuffer.allocate(200);
  m_Base.checkInit();
  GXAPDU aarq=new GXAPDU(Tags);
  aarq.setUseLN(this.getUseLogicalNameReferencing());
  if (this.getUseLogicalNameReferencing()) {
    m_Base.setSNSettings(null);
    m_Base.setLNSettings(new GXDLMSLNSettings(new byte[]{0x00,0x7E,0x1F}));
    aarq.userInformation.conformanceBlock=getLNSettings().conformanceBlock;
  }
 else {
    m_Base.setLNSettings(null);
    m_Base.setSNSettings(new GXDLMSSNSettings(new byte[]{0x1C,0x03,0x20}));
    aarq.userInformation.conformanceBlock=getSNSettings().conformanceBlock;
  }
  aarq.setAuthentication(this.getAuthentication(),getPassword());
  aarq.userInformation.dlmsVersioNumber=getDLMSVersion();
  aarq.userInformation.maxReceivePDUSize=getMaxReceivePDUSize();
  m_Base.StoCChallenge=null;
  if (getAuthentication().ordinal() > Authentication.HIGH.ordinal()) {
    m_Base.CtoSChallenge=GXDLMS.generateChallenge();
  }
 else {
    m_Base.CtoSChallenge=null;
  }
  try {
    aarq.codeData(buff,getInterfaceType(),m_Base.CtoSChallenge);
  }
 catch (  UnsupportedEncodingException ex) {
    throw new RuntimeException(ex.getMessage());
  }
  m_Base.frameSequence=-1;
  m_Base.expectedFrame=-1;
  return m_Base.splitToBlocks(buff,Command.None);
}

Fixed version (ground truth):
/** 
 * Generate AARQ request.  Because all meters can't read all data in one packet,  the packet must be split first, by using SplitDataToPackets method.
 * @param Tags
 * @return AARQ request as byte array.
 * @see GXDLMSClient#parseAAREResponse     
 * @see GXDLMSClient#isDLMSPacketComplete
 */
public final byte[][] AARQRequest(GXDLMSTagCollection Tags){
  java.nio.ByteBuffer buff=java.nio.ByteBuffer.allocate(200);
  m_Base.checkInit();
  GXAPDU aarq=new GXAPDU(Tags);
  aarq.setUseLN(this.getUseLogicalNameReferencing());
  if (this.getUseLogicalNameReferencing()) {
    m_Base.setSNSettings(null);
    m_Base.setLNSettings(new GXDLMSLNSettings(new byte[]{0x00,0x7E,0x1F}));
    aarq.userInformation.conformanceBlock=getLNSettings().conformanceBlock;
  }
 else {
    m_Base.setLNSettings(null);
    m_Base.setSNSettings(new GXDLMSSNSettings(new byte[]{0x1C,0x03,0x20}));
    aarq.userInformation.conformanceBlock=getSNSettings().conformanceBlock;
  }
  aarq.setAuthentication(this.getAuthentication(),getPassword());
  aarq.userInformation.dlmsVersioNumber=getDLMSVersion();
  aarq.userInformation.maxReceivePDUSize=getMaxReceivePDUSize();
  m_Base.StoCChallenge=null;
  if (getAuthentication().ordinal() > Authentication.HIGH.ordinal()) {
    m_Base.CtoSChallenge=GXDLMS.generateChallenge();
  }
 else {
    m_Base.CtoSChallenge=null;
  }
  try {
    aarq.codeData(buff,getInterfaceType(),m_Base.CtoSChallenge);
  }
 catch (  UnsupportedEncodingException ex) {
    throw new RuntimeException(ex.getMessage());
  }
  m_Base.frameSequence=-1;
  m_Base.expectedFrame=-1;
  return m_Base.splitToBlocks(buff,Command.None,false);
}