Program: 17831
Project: 17831
Buggy source:
private void appendInlineEntry(final XMLStreamWriter writer,final String navigationPropertyName,final EntityInfoAggregator eia,final Map<String,Object> data) throws EntityProviderException, XMLStreamException, EdmException {
  if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
    if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
      writer.writeStartElement(Edm.NAMESPACE_M_2007_08,FormatXml.M_INLINE);
      EdmNavigationProperty navProp=(EdmNavigationProperty)eia.getEntityType().getProperty(navigationPropertyName);
      WriteEntryCallbackContext context=new WriteEntryCallbackContext();
      context.setSourceEntitySet(eia.getEntitySet());
      context.setNavigationProperty(navProp);
      context.setEntryData(data);
      ExpandSelectTreeNode subNode=properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
      context.setCurrentExpandSelectTreeNode(subNode);
      ODataCallback callback=properties.getCallbacks().get(navigationPropertyName);
      if (callback == null) {
        throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
      }
      WriteEntryCallbackResult result=null;
      try {
        result=((OnWriteEntryContent)callback).retrieveEntryResult(context);
      }
 catch (      ODataApplicationException e) {
        throw new EntityProviderException(EntityProviderException.COMMON,e);
      }
      Map<String,Object> inlineData=result.getEntryData();
      if (inlineData != null) {
        EntityProviderWriteProperties inlineProperties=result.getInlineProperties();
        EdmEntitySet inlineEntitySet=eia.getEntitySet().getRelatedEntitySet(navProp);
        AtomEntryEntityProducer inlineProducer=new AtomEntryEntityProducer(inlineProperties);
        EntityInfoAggregator inlineEia=EntityInfoAggregator.create(inlineEntitySet,inlineProperties.getExpandSelectTree());
        inlineProducer.append(writer,inlineEia,inlineData,false,false);
      }
      writer.writeEndElement();
    }
  }
}

Fixed version (ground truth):
private void appendInlineEntry(final XMLStreamWriter writer,final String navigationPropertyName,final EntityInfoAggregator eia,final Map<String,Object> data) throws EntityProviderException, XMLStreamException, EdmException {
  if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
    if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
      writer.writeStartElement(Edm.NAMESPACE_M_2007_08,FormatXml.M_INLINE);
      EdmNavigationProperty navProp=(EdmNavigationProperty)eia.getEntityType().getProperty(navigationPropertyName);
      WriteEntryCallbackContext context=new WriteEntryCallbackContext();
      context.setSourceEntitySet(eia.getEntitySet());
      context.setNavigationProperty(navProp);
      context.setEntryData(data);
      ExpandSelectTreeNode subNode=properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
      context.setCurrentExpandSelectTreeNode(subNode);
      ODataCallback callback=properties.getCallbacks().get(navigationPropertyName);
      if (callback == null) {
        throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
      }
      WriteEntryCallbackResult result=null;
      try {
        result=((OnWriteEntryContent)callback).retrieveEntryResult(context);
      }
 catch (      ODataApplicationException e) {
        throw new EntityProviderException(EntityProviderException.COMMON,e);
      }
      Map<String,Object> inlineData=result.getEntryData();
      if (inlineData != null && !inlineData.isEmpty()) {
        EntityProviderWriteProperties inlineProperties=result.getInlineProperties();
        EdmEntitySet inlineEntitySet=eia.getEntitySet().getRelatedEntitySet(navProp);
        AtomEntryEntityProducer inlineProducer=new AtomEntryEntityProducer(inlineProperties);
        EntityInfoAggregator inlineEia=EntityInfoAggregator.create(inlineEntitySet,inlineProperties.getExpandSelectTree());
        inlineProducer.append(writer,inlineEia,inlineData,false,false);
      }
      writer.writeEndElement();
    }
  }
}