// save comment lines after dns
LdifCommentLine[] commentLines = getCommentLines();
// check record type: to decide the record type we need the next token
// first check keywords 'control' and 'changetype'
LdifControlLine controlLine = getControlLine();
LdifChangeTypeLine changeTypeLine = getChangeTypeLine();
if ( controlLine != null || changeTypeLine != null )
{
LdifChangeRecord record = null;
// save all parts before changetype line
List partList = new ArrayList();
if ( dnErrorToken != null )
{
partList.add( new LdifInvalidPart( dnErrorToken.getOffset(), dnErrorToken.getValue() ) );
}
for ( int i = 0; i < commentLines.length; i++ )
{
partList.add( commentLines[i] );
}
if ( controlLine != null )
{
partList.add( controlLine );
if ( !controlLine.isValid() )
{
LdifToken errorToken = this.cleanupLine();
if ( errorToken != null )
{
partList.add( new LdifInvalidPart( errorToken.getOffset(), errorToken.getValue() ) );
}
}
}
// save comments and controls before changetype line
while ( changeTypeLine == null && ( commentLines.length > 0 || controlLine != null ) )
{
commentLines = getCommentLines();
for ( int i = 0; i < commentLines.length; i++ )
{
partList.add( commentLines[i] );
}
controlLine = getControlLine();
if ( controlLine != null )
{
partList.add( controlLine );
if ( !controlLine.isValid() )
{
LdifToken errorToken = this.cleanupLine();
if ( errorToken != null )
{
partList.add( new LdifInvalidPart( errorToken.getOffset(), errorToken.getValue() ) );