Program: 84899
Project: 84899
Buggy source:
/** 
 * translate beans to choosen language. (detach ones if needed)
 */
public <T>Collection<T> translateBeans(Collection<T> beans,String languageCode,boolean deep,boolean detached){
  System.err.println("String_Node_Str");
  if (beans == null) {
    return beans;
  }
  if (!detached) {
    beans=JpaEx.<Collection<T>>serializeAndDeserialize(beans);
  }
  Iterator<T> it=beans.iterator();
  if (!it.hasNext()) {
    return beans;
  }
  String lc=languageCode.toUpperCase();
  Class<T> entityClass;
{
    T bean=it.next();
    entityClass=JpaHelper.findSameOrSuperJpaEntity(bean.getClass());
    if (entityClass == null) {
      return beans;
    }
  }
  EntityCacheEntry<T> metaDataEntry=getOrCreateEntityCacheEntry(entityClass.getName());
  if (metaDataEntry == null) {
    throw new IllegalArgumentException("String_Node_Str" + entityClass + "String_Node_Str");
  }
  Map<String,BundleInfo> bis=new TreeMap<String,BundleInfo>();
  for (  JpaEntityProperty<T,String> p : metaDataEntry.stringPropertiesByName.values()) {
    String poName=p.getEntityClass().getName();
    EntityCacheEntry poEntry=getOrCreateEntityCacheEntry(poName);
    if (!bis.containsKey(poName)) {
      if (poEntry.tt != null) {
        BundleInfo bi=poEntry.tt.getBundle();
        boolean supportedLanguageFound=false;
        for (        LanguageInfo li : bi.getSupportedLanguages()) {
          if (li.getCode().equalsIgnoreCase(languageCode)) {
            supportedLanguageFound=true;
            break;
          }
        }
        if (!supportedLanguageFound) {
          throw new IllegalArgumentException("String_Node_Str" + languageCode + "String_Node_Str");
        }
        bis.put(poName,bi);
      }
    }
  }
  List<Object> ids=new ArrayList<Object>();
  for (  T bean : beans) {
    ids.add(metaDataEntry.idProperty.getValue(bean));
  }
  Map<String,List<List<String>>> translatedPerClass=new TreeMap<String,List<List<String>>>();
  Map<String,List<JpaEntityProperty<? super T,String>>> propertiesPerClass=new TreeMap<String,List<JpaEntityProperty<? super T,String>>>();
  for (  Map.Entry<String,EntityCacheEntry<? super T>> e : metaDataEntry.slicedEntries.entrySet()) {
    TranslationTable tt=e.getValue().tt;
    if (tt == null)     continue;
    List<JpaEntityProperty<? super T,String>> fieldProperties=new ArrayList<JpaEntityProperty<? super T,String>>();
    for (    TranslationTableColumn tc : tt.getTranslatedColumns()) {
      JpaEntityProperty<? super T,String> fieldProperty=e.getValue().stringPropertiesByNormalizedColumnName.get(tc.getColumnName());
      if (fieldProperty == null) {
        throw new IllegalStateException("String_Node_Str" + tc.getColumnName());
      }
      fieldProperties.add(fieldProperty);
    }
    List<List<String>> translatedForKey=translateFieldsByIds(languageCode,e.getValue(),ids,fieldProperties);
    translatedPerClass.put(e.getKey(),translatedForKey);
    propertiesPerClass.put(e.getKey(),fieldProperties);
  }
  System.err.println("String_Node_Str" + languageCode);
  it=beans.iterator();
  for (int i=0; it.hasNext(); ++i) {
    T bean=it.next();
    for (    Map.Entry<String,List<List<String>>> e : translatedPerClass.entrySet()) {
      if (e.getValue().size() == 0) {
        continue;
      }
      List<String> translatedRow=e.getValue().get(i);
      List<JpaEntityProperty<? super T,String>> fieldProperties=propertiesPerClass.get(e.getKey());
      for (int j=0; j < fieldProperties.size(); ++j) {
        System.err.println("String_Node_Str" + fieldProperties.get(j).getName() + "String_Node_Str"+ translatedRow.get(j));
        fieldProperties.get(j).setValue(bean,translatedRow.get(j));
      }
    }
    if (deep) {
      System.err.println("String_Node_Str");
      for (      JpaEntityProperty p : JpaHelper.getAllJpaProperties(entityClass)) {
        System.err.print("String_Node_Str" + p.getName());
        Class propertyClass=p.getPropertyClass();
        if (!propertyClass.isPrimitive() && !Number.class.isAssignableFrom(propertyClass) && !String.class.isAssignableFrom(propertyClass)) {
          Object v=p.getValue(bean);
          if (v != null) {
            System.err.println("String_Node_Str" + v.toString());
            Object tv=translateBean(v,languageCode,deep,true);
            p.setValue(bean,tv);
          }
        }
      }
      System.err.println("String_Node_Str");
    }
  }
  System.err.println("String_Node_Str");
  return beans;
}

Fixed version (ground truth):
/** 
 * translate beans to choosen language. (detach ones if needed)
 */
public <T>Collection<T> translateBeans(Collection<T> beans,String languageCode,boolean deep,boolean detached){
  if (beans == null) {
    return beans;
  }
  if (!detached) {
    beans=JpaEx.getInstance().<Collection<T>>detached(getEntityManager(),beans);
  }
  Iterator<T> it=beans.iterator();
  if (!it.hasNext()) {
    return beans;
  }
  languageCode=languageCode.toUpperCase();
  Class<T> entityClass;
{
    T bean=it.next();
    entityClass=JpaHelper.findSameOrSuperJpaEntity(bean.getClass());
    if (entityClass == null) {
      return beans;
    }
  }
  EntityCacheEntry<T> metaDataEntry=getOrCreateEntityCacheEntry(entityClass.getName());
  if (metaDataEntry == null) {
    throw new IllegalArgumentException("String_Node_Str" + entityClass + "String_Node_Str");
  }
  Map<String,BundleInfo> bis=new TreeMap<String,BundleInfo>();
  for (  JpaEntityProperty<T,String> p : metaDataEntry.stringPropertiesByName.values()) {
    String poName=p.getEntityClass().getName();
    EntityCacheEntry poEntry=getOrCreateEntityCacheEntry(poName);
    if (!bis.containsKey(poName)) {
      if (poEntry.tt != null) {
        BundleInfo bi=poEntry.tt.getBundle();
        boolean supportedLanguageFound=false;
        for (        LanguageInfo li : bi.getSupportedLanguages()) {
          if (li.getCode().equalsIgnoreCase(languageCode)) {
            supportedLanguageFound=true;
            break;
          }
        }
        if (!supportedLanguageFound) {
          throw new IllegalArgumentException("String_Node_Str" + languageCode + "String_Node_Str");
        }
        bis.put(poName,bi);
      }
    }
  }
  List<Object> ids=new ArrayList<Object>();
  for (  T bean : beans) {
    ids.add(metaDataEntry.idProperty.getValue(bean));
  }
  Map<String,List<List<String>>> translatedPerClass=new TreeMap<String,List<List<String>>>();
  Map<String,List<JpaEntityProperty<? super T,String>>> propertiesPerClass=new TreeMap<String,List<JpaEntityProperty<? super T,String>>>();
  for (  Map.Entry<String,EntityCacheEntry<? super T>> e : metaDataEntry.slicedEntries.entrySet()) {
    TranslationTable tt=e.getValue().tt;
    if (tt == null)     continue;
    List<JpaEntityProperty<? super T,String>> fieldProperties=new ArrayList<JpaEntityProperty<? super T,String>>();
    for (    TranslationTableColumn tc : tt.getTranslatedColumns()) {
      JpaEntityProperty<? super T,String> fieldProperty=e.getValue().stringPropertiesByNormalizedColumnName.get(tc.getColumnName());
      if (fieldProperty == null) {
        throw new IllegalStateException("String_Node_Str" + tc.getColumnName());
      }
      fieldProperties.add(fieldProperty);
    }
    List<List<String>> translatedForKey=translateFieldsByIds(languageCode,e.getValue(),ids,fieldProperties);
    translatedPerClass.put(e.getKey(),translatedForKey);
    propertiesPerClass.put(e.getKey(),fieldProperties);
  }
  it=beans.iterator();
  for (int i=0; it.hasNext(); ++i) {
    T bean=it.next();
    for (    Map.Entry<String,List<List<String>>> e : translatedPerClass.entrySet()) {
      if (e.getValue().size() == 0) {
        continue;
      }
      List<String> translatedRow=e.getValue().get(i);
      List<JpaEntityProperty<? super T,String>> fieldProperties=propertiesPerClass.get(e.getKey());
      if (fieldProperties.size() == 0) {
        continue;
      }
      for (int j=0; j < fieldProperties.size(); ++j) {
        String translation=translatedRow.get(j);
        fieldProperties.get(j).setValue(bean,translation);
      }
    }
    if (deep) {
      List<JpaEntityProperty> properties=JpaHelper.getAllJpaProperties(entityClass);
      for (      JpaEntityProperty p : properties) {
        Class propertyClass=p.getPropertyClass();
        if (!propertyClass.isPrimitive() && !Number.class.isAssignableFrom(propertyClass) && !String.class.isAssignableFrom(propertyClass)) {
          Object v=p.getValue(bean);
          if (v != null) {
            Object tv=translateBean(v,languageCode,deep,true);
            p.setValue(bean,tv);
          }
        }
      }
    }
  }
  return beans;
}