Program: 43764
Project: 43764
Buggy source:
public Entity<?> make(DatabaseMeta db,Connection conn,Class<?> type){
  Entity<?> entity=new Entity<Object>();
  Mirror<?> mirror=Mirror.me(type);
  entity.setMirror(mirror);
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",type.getName(),db.getTypeName());
  entity.setTableName(evalEntityName(type,Table.class,null));
  entity.setViewName(evalEntityName(type,View.class,Table.class));
  entity.setBorning(Borns.evalBorning(entity));
  boolean existsColumnAnnField=isPojoExistsColumnAnnField(mirror);
  HashMap<String,EntityField> pkmap=new HashMap<String,EntityField>();
  PK pk=type.getAnnotation(PK.class);
  if (null != pk) {
    for (    String pknm : pk.value())     pkmap.put(pknm,null);
  }
  Statement stat=null;
  ResultSet rs=null;
  ResultSetMetaData rsmd=null;
  List<FieldQuery> befores;
  List<FieldQuery> afters;
  try {
    try {
      stat=conn.createStatement();
      rs=stat.executeQuery(db.getResultSetMetaSql(entity.getViewName()));
      rsmd=rs.getMetaData();
    }
 catch (    Exception e) {
      if (log.isWarnEnabled())       log.warn("String_Node_Str" + entity.getViewName() + "String_Node_Str");
    }
    befores=new ArrayList<FieldQuery>(5);
    afters=new ArrayList<FieldQuery>(5);
    for (    Field f : mirror.getFields()) {
      Link link=evalLink(db,conn,mirror,f);
      if (null != link) {
        entity.addLinks(link);
      }
 else {
        if (existsColumnAnnField && null == f.getAnnotation(Column.class))         continue;
        EntityField ef=evalField(db,rsmd,entity,f);
        if (pkmap.containsKey(ef.getName())) {
          pkmap.put(ef.getName(),ef);
          if (!(ef.isId() || ef.isName()))           ef.setType(FieldType.PK);
        }
        if (null != ef.getBeforeInsert())         befores.add(ef.getBeforeInsert());
 else         if (null != ef.getAfterInsert())         afters.add(ef.getAfterInsert());
        if (null != ef) {
          entity.addField(ef);
        }
      }
    }
  }
 catch (  SQLException e) {
    throw Lang.wrapThrow(e,"String_Node_Str",type);
  }
 finally {
    Daos.safeClose(stat,rs);
  }
  if (pkmap.size() > 0) {
    EntityField[] pks=new EntityField[pkmap.size()];
    for (int i=0; i < pk.value().length; i++)     pks[i]=pkmap.get(pk.value()[i]);
    entity.setPkFields(pks);
  }
  entity.setBefores(befores.toArray(new FieldQuery[befores.size()]));
  entity.setAfters(afters.toArray(new FieldQuery[afters.size()]));
  return entity;
}

Fixed version (ground truth):
public Entity<?> make(DatabaseMeta db,Connection conn,Class<?> type){
  Entity<?> entity=new Entity<Object>();
  Mirror<?> mirror=Mirror.me(type);
  entity.setMirror(mirror);
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",type.getName(),db.getTypeName());
  entity.setTableName(evalEntityName(type,Table.class,null));
  entity.setViewName(evalEntityName(type,View.class,Table.class));
  entity.setBorning(Borns.evalBorning(entity));
  boolean existsColumnAnnField=isPojoExistsColumnAnnField(mirror);
  HashMap<String,EntityField> pkmap=new HashMap<String,EntityField>();
  PK pk=type.getAnnotation(PK.class);
  if (null != pk) {
    for (    String pknm : pk.value())     pkmap.put(pknm,null);
  }
  Statement stat=null;
  ResultSet rs=null;
  ResultSetMetaData rsmd=null;
  List<FieldQuery> befores;
  List<FieldQuery> afters;
  try {
    try {
      stat=conn.createStatement();
      rs=stat.executeQuery(db.getResultSetMetaSql(entity.getViewName()));
      rsmd=rs.getMetaData();
    }
 catch (    Exception e) {
      if (log.isWarnEnabled())       log.warn("String_Node_Str" + entity.getViewName() + "String_Node_Str");
    }
    befores=new ArrayList<FieldQuery>(5);
    afters=new ArrayList<FieldQuery>(5);
    for (    Field f : mirror.getFields()) {
      Link link=evalLink(db,conn,mirror,f);
      if (null != link) {
        entity.addLinks(link);
      }
 else {
        if (existsColumnAnnField)         if (!pkmap.containsKey(f.getName()))         if (null == f.getAnnotation(Column.class))         if (null == f.getAnnotation(Id.class))         if (null == f.getAnnotation(Name.class))         continue;
        EntityField ef=evalField(db,rsmd,entity,f);
        if (pkmap.containsKey(ef.getName())) {
          pkmap.put(ef.getName(),ef);
          if (!(ef.isId() || ef.isName()))           ef.setType(FieldType.PK);
        }
        if (null != ef.getBeforeInsert())         befores.add(ef.getBeforeInsert());
 else         if (null != ef.getAfterInsert())         afters.add(ef.getAfterInsert());
        if (null != ef) {
          entity.addField(ef);
        }
      }
    }
  }
 catch (  SQLException e) {
    throw Lang.wrapThrow(e,"String_Node_Str",type);
  }
 finally {
    Daos.safeClose(stat,rs);
  }
  if (pkmap.size() > 0) {
    EntityField[] pks=new EntityField[pkmap.size()];
    for (int i=0; i < pk.value().length; i++)     pks[i]=pkmap.get(pk.value()[i]);
    entity.setPkFields(pks);
  }
  entity.setBefores(befores.toArray(new FieldQuery[befores.size()]));
  entity.setAfters(afters.toArray(new FieldQuery[afters.size()]));
  return entity;
}