Buggy code:
public class AtomEntityEntryFormatWriter { private static final Logger logger = LoggerFactory . getLogger ( AtomEntityEntryFormatWriter . class ) ; public static final String d = "http:////schemas.microsoft.com//ado//2007//08//dataservices" ; public static final String m = "http:////schemas.microsoft.com//ado//2007//08//dataservices//metadata" ; public static final String scheme = "http:////schemas.microsoft.com//ado//2007//08//dataservices//scheme" ; public static final String atom_feed_content_type = "application//atom+xml;type=feed" ; public static final String atom_entry_content_type = "application//atom+xml;type=entry" ; public static final String href_lang = "en" ; private ResourceState serviceDocument ; private Metadata metadata ; public AtomEntityEntryFormatWriter ( ResourceState serviceDocument , Metadata metadata ) { } public void write ( UriInfo uriInfo , Writer w , String entityName , Entity entity , Collection < Link > links , Map < Transition , RESTResource > embeddedResources ) { } private String getAbsoluteId ( UriInfo uriInfo , Collection < Link > links ) { } public void writeEntry ( StreamWriter writer , String entitySetName , String entityName , Entity entity , Collection < Link > entityLinks , Map < Transition , RESTResource > embeddedResources , UriInfo uriInfo , String updated ) { } protected void writeEntry ( StreamWriter writer , String entityName , Entity entity , Collection < Link > entityLinks , Map < Transition , RESTResource > embeddedResources , String baseUri , String absoluteId , String updated ) { } private void writeEntityResource ( StreamWriter writer , EntityResource < Entity > entityResource , String baseUri , String absoluteId , String updated ) { } @ SuppressWarnings ( "unchecked" ) protected void writeLinkInline ( StreamWriter writer , Metadata metadata , Link linkToInline , RESTResource embeddedResource , String href , String baseUri , String absoluteId , String updated ) { } private String getAbsoluteId ( String baseUri , String entitySetName , Entity entity , EntityMetadata entityMetadata ) { } private void writeProperties ( StreamWriter writer , EntityMetadata entityMetadata , EntityProperties entityProperties , String modelName ) { } private void writeProperty ( StreamWriter writer , EntityMetadata entityMetadata , EntityProperty property ) { } private void writePropertyComplexList ( StreamWriter writer , EntityMetadata entityMetadata , EntityProperty property , String modelName ) { @ SuppressWarnings ( "unchecked" ) List < EntityProperties > propertiesList = ( ( List < EntityProperties > ) ( property . getValue ( ) ) ) ; String name = ( ( entityMetadata . getEntityName ( ) ) + "_" ) + ( property . getName ( ) ) ; int parseCount = 0 ; for ( EntityProperties properties : propertiesList ) { String fqTypeName = ( ( modelName + ( Metadata . MODEL_SUFFIX ) ) + "." ) + name ; if ( entityMetadata . isPropertyList ( property . getFullyQualifiedName ( ) ) ) { if ( parseCount == 0 ) { writer . startElement ( new QName ( AtomEntityEntryFormatWriter . d , name , "d" ) ) ; writer . writeAttribute ( new QName ( AtomEntityEntryFormatWriter . m , "type" , "m" ) , ( ( "Bag(" + fqTypeName ) + ")" ) ) ; writer . startElement ( new QName ( AtomEntityEntryFormatWriter . d , "element" , "d" ) ) ; parseCount ++ ; } else { writer . startElement ( new QName ( AtomEntityEntryFormatWriter . d , "element" , "d" ) ) ; } } else { writer . startElement ( new QName ( AtomEntityEntryFormatWriter . d , name , "d" ) ) ; writer . writeAttribute ( new QName ( AtomEntityEntryFormatWriter . m , "type" , "m" ) , fqTypeName ) ; } writeProperties ( writer , entityMetadata , properties , modelName ) ; writer . endElement ( ) ; } <START_BUG> if ( entityMetadata . isPropertyList ( property . getFullyQualifiedName ( ) ) ) { <END_BUG> writer . endElement ( ) ; } } private OAtomEntity getAtomInfo ( Entity e ) { } }

Fix:
if ( ( ! ( propertiesList . isEmpty ( ) ) ) && ( entityMetadata . isPropertyList ( property . getFullyQualifiedName ( ) ) ) ) {