You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/11/25 03:52:55 UTC
svn commit: r597945 -
/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
Author: elecharny
Date: Sat Nov 24 18:52:55 2007
New Revision: 597945
URL: http://svn.apache.org/viewvc?rev=597945&view=rev
Log:
Fixed the parseModify to avoid multiple modifications on a single attribute to be mixed
Modified:
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java?rev=597945&r1=597944&r2=597945&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java Sat Nov 24 18:52:55 2007
@@ -959,7 +959,8 @@
{
int state = MOD_SPEC;
String modified = null;
- int modification = 0;
+ int modificationType = 0;
+ Attribute attribute = null;
// The following flag is used to deal with empty modifications
boolean isEmptyValue = true;
@@ -981,7 +982,12 @@
if ( isEmptyValue )
{
// Update the entry
- entry.addModificationItem( modification, modified, null );
+ entry.addModificationItem( modificationType, modified, null );
+ }
+ else
+ {
+ // Update the entry with the attribute
+ entry.addModificationItem( modificationType, attribute );
}
state = MOD_SPEC;
@@ -998,7 +1004,8 @@
}
modified = StringTools.trim( line.substring( "add:".length() ) );
- modification = DirContext.ADD_ATTRIBUTE;
+ modificationType = DirContext.ADD_ATTRIBUTE;
+ attribute = new AttributeImpl( modified );
state = ATTRVAL_SPEC;
}
@@ -1011,7 +1018,8 @@
}
modified = StringTools.trim( line.substring( "delete:".length() ) );
- modification = DirContext.REMOVE_ATTRIBUTE;
+ modificationType = DirContext.REMOVE_ATTRIBUTE;
+ attribute = new AttributeImpl( modified );
state = ATTRVAL_SPEC_OR_SEP;
}
@@ -1024,7 +1032,8 @@
}
modified = StringTools.trim( line.substring( "replace:".length() ) );
- modification = DirContext.REPLACE_ATTRIBUTE;
+ modificationType = DirContext.REPLACE_ATTRIBUTE;
+ attribute = new AttributeImpl( modified );
state = ATTRVAL_SPEC_OR_SEP;
}
@@ -1056,8 +1065,8 @@
Object attributeValue = parseValue( line, colonIndex );
- // Update the entry
- entry.addModificationItem( modification, modified, attributeValue );
+ attribute.add( attributeValue );
+
isEmptyValue = false;
state = ATTRVAL_SPEC_OR_SEP;