Changeset 1914


Ignore:
Timestamp:
Mar 21, 2013, 9:12:16 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #482: RNA item without a Lysate parent cause NullPointerException? in ScanBQuarterMonthReportServlet

And a similiar issue for DNA to prevent it from appearing in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ScanBQuarterMonthReportServlet.java

    r1880 r1914  
    1515
    1616import net.sf.basedb.core.Application;
     17import net.sf.basedb.core.BioMaterial;
    1718import net.sf.basedb.core.DbControl;
    1819import net.sf.basedb.core.Extract;
     
    403404      if (extract.getItemSubtype().equals(subtypeDna))
    404405      {
    405         for (Extract lysate: extractLysateList)
    406         {
    407           if (extract.getParent().equals(lysate))
    408           {
    409             extractDnaList.add(extract);
    410             date = (Date) Annotationtype.QIACUBE_DATE.getAnnotationValue(dc, manager, extract);
    411             extractIdQiaCubeDateHashMap.put(extract.getId(), date);
    412             Sample sample = (Sample) lysate.getParent();
    413             sampleDnaList.add(sample);
    414             sampleIdQiaCubeDateHashMap.put(sample.getId(), date);
    415             // Store sample id for DNA yield calculation
    416             extractIdSampleIdHashMap.put(extract.getId(), sample.getId());
    417             break;
    418           }
     406        BioMaterial dnaParent = extract.getParent();
     407        if (extractLysateList.contains(dnaParent))
     408        {
     409          Extract lysate = (Extract)dnaParent;
     410          extractDnaList.add(extract);
     411          date = (Date) Annotationtype.QIACUBE_DATE.getAnnotationValue(dc, manager, extract);
     412          extractIdQiaCubeDateHashMap.put(extract.getId(), date);
     413          Sample sample = (Sample) lysate.getParent();
     414          sampleDnaList.add(sample);
     415          sampleIdQiaCubeDateHashMap.put(sample.getId(), date);
     416          // Store sample id for DNA yield calculation
     417          extractIdSampleIdHashMap.put(extract.getId(), sample.getId());
    419418        }
    420419      }
    421420      else if (extract.getItemSubtype().equals(subtypeRna))
    422421      {
    423         for (Extract lysate: extractLysateList)
    424         {
    425           if (extract.getParent().equals(lysate))
    426           {
    427             extractRnaList.add(extract);
    428             date = (Date) Annotationtype.QIACUBE_DATE.getAnnotationValue(dc, manager, extract);
    429             extractIdQiaCubeDateHashMap.put(extract.getId(), date);
    430             Sample sample = (Sample) lysate.getParent();
    431             sampleRnaList.add(sample);
    432             sampleIdQiaCubeDateHashMap.put(sample.getId(), date);
    433             // Store sample id for RNA yield calculation
    434             extractIdSampleIdHashMap.put(extract.getId(), sample.getId());
    435             break;
    436           }
     422        BioMaterial rnaParent = extract.getParent();
     423        if (extractLysateList.contains(rnaParent))
     424        {
     425          Extract lysate = (Extract)rnaParent;
     426          extractRnaList.add(extract);
     427          date = (Date) Annotationtype.QIACUBE_DATE.getAnnotationValue(dc, manager, extract);
     428          extractIdQiaCubeDateHashMap.put(extract.getId(), date);
     429          Sample sample = (Sample) lysate.getParent();
     430          sampleRnaList.add(sample);
     431          sampleIdQiaCubeDateHashMap.put(sample.getId(), date);
     432          // Store sample id for RNA yield calculation
     433          extractIdSampleIdHashMap.put(extract.getId(), sample.getId());
    437434        }
    438435      }
Note: See TracChangeset for help on using the changeset viewer.