Program: 81520
Project: 81520
Buggy source:
/** 
 * new table spec should insert columns after the index columns are defined by pattern groups,  data type dependent if group expects to be of a certain type
 * @param inSpec
 * @param pattern
 * @param bcIdx
 * @return
 */
private ColumnRearranger createColumnRearranger(DataTableSpec inSpec,final NamedPattern pattern,final int bcIdx,final int insertAt){
  final List<String> groupNames=pattern.groupNames();
  final int newColCount=groupNames.size();
  final DataColumnSpec[] newColSpecs=new DataColumnSpec[newColCount];
  final LinkedHashMap<String,DataType> typeMapping=new LinkedHashMap<String,DataType>();
  for (int i=0; i < newColCount; i++) {
    String group=groupNames.get(i);
    DataType dtype=StringCell.TYPE;
    if (BarcodeParser.longGroupNames.containsKey(group) && BarcodeParser.groupTypes.containsKey(group)) {
      dtype=getColumnType(group);
    }
    typeMapping.put(group,dtype);
    group=BarcodeParser.longGroupNames.get(group);
    String name=DataTableSpec.getUniqueColumnName(inSpec,group);
    newColSpecs[i]=new DataColumnSpecCreator(name,dtype).createSpec();
  }
  ColumnRearranger rearranger=new ColumnRearranger(inSpec);
  rearranger.insertAt(insertAt + 1,new AbstractCellFactory(newColSpecs){
    /** 
 * {@inheritDoc} 
 */
    @Override public DataCell[] getCells(    final DataRow row){
      DataCell[] result=new DataCell[newColCount];
      Arrays.fill(result,DataType.getMissingCell());
      DataCell c=row.getCell(bcIdx);
      if (c.isMissing()) {
        return result;
      }
      DataCellFactory cellFactory=new DataCellFactory();
      String s=((StringValue)c).getStringValue();
      BarcodeParser parser=new BarcodeParser(s,pattern);
      if (!parser.doesMatchPattern()) {
        Integer count=invalidBarcodes.get(s) == null ? 1 : invalidBarcodes.get(s) + 1;
        invalidBarcodes.put(s,count);
        return result;
      }
      int i=0;
      for (      String group : typeMapping.keySet()) {
        DataType dtype=typeMapping.get(group);
        String substring=parser.getGroup(group);
        result[i]=cellFactory.createDataCellOfType(dtype,substring);
        i++;
      }
      return result;
    }
  }
);
  return rearranger;
}

Fixed version (ground truth):
/** 
 * new table spec should insert columns after the index columns are defined by pattern groups,  data type dependent if group expects to be of a certain type
 * @param inSpec
 * @param pattern
 * @param bcIdx
 * @return
 */
private ColumnRearranger createColumnRearranger(DataTableSpec inSpec,final NamedPattern pattern,final int bcIdx,final int insertAt){
  final List<String> groupNames=pattern.groupNames();
  final int newColCount=groupNames.size();
  final DataColumnSpec[] newColSpecs=new DataColumnSpec[newColCount];
  final LinkedHashMap<String,DataType> typeMapping=new LinkedHashMap<String,DataType>();
  for (int i=0; i < newColCount; i++) {
    String group=groupNames.get(i);
    DataType dtype=StringCell.TYPE;
    typeMapping.put(group,dtype);
    if (BarcodeParser.longGroupNames.containsKey(group) && BarcodeParser.groupTypes.containsKey(group)) {
      group=BarcodeParser.longGroupNames.get(group);
    }
    String name=DataTableSpec.getUniqueColumnName(inSpec,group);
    newColSpecs[i]=new DataColumnSpecCreator(name,dtype).createSpec();
  }
  ColumnRearranger rearranger=new ColumnRearranger(inSpec);
  rearranger.insertAt(insertAt + 1,new AbstractCellFactory(newColSpecs){
    /** 
 * {@inheritDoc} 
 */
    @Override public DataCell[] getCells(    final DataRow row){
      DataCell[] result=new DataCell[newColCount];
      Arrays.fill(result,DataType.getMissingCell());
      DataCell c=row.getCell(bcIdx);
      if (c.isMissing()) {
        return result;
      }
      DataCellFactory cellFactory=new DataCellFactory();
      String s=((StringValue)c).getStringValue();
      BarcodeParser parser=new BarcodeParser(s,pattern);
      if (!parser.doesMatchPattern()) {
        Integer count=invalidBarcodes.get(s) == null ? 1 : invalidBarcodes.get(s) + 1;
        invalidBarcodes.put(s,count);
        return result;
      }
      int i=0;
      for (      String group : typeMapping.keySet()) {
        DataType dtype=typeMapping.get(group);
        String substring=parser.getGroup(group);
        result[i]=cellFactory.createDataCellOfType(dtype,substring);
        i++;
      }
      return result;
    }
  }
);
  return rearranger;
}