Changeset 6546


Ignore:
Timestamp:
Oct 2, 2014, 11:13:31 AM (8 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1855: ItemNotFoundException? when creating a new raw bioassay

Location:
branches/3.3-stable/src/core/net/sf/basedb/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-stable/src/core/net/sf/basedb/core/DbControl.java

    r6444 r6546  
    904904        {
    905905          throw new ItemNotFoundException(HibernateUtil.getShortEntityName(ex.getEntityName())+
    906             "[id="+ex.getIdentifier()+"]");
     906            "[id="+ex.getIdentifier()+"]", ex);
    907907        }
    908908      }
  • branches/3.3-stable/src/core/net/sf/basedb/core/Project.java

    r6434 r6546  
    4949import java.util.Set;
    5050import java.util.Collections;
     51
     52import org.hibernate.Hibernate;
    5153
    5254/**
     
    936938
    937939    Class dataClass = itemType.getDataClass();
    938     for (BasicData data : defaultItems.getValues())
    939     {
     940    Iterator<BasicData> it = defaultItems.getValues().iterator();
     941    while (it.hasNext())
     942    {
     943      BasicData data = it.next();
    940944      if (dataClass.isInstance(data))
    941945      {
     946        // Check if item has been removed
     947        try
     948        {
     949          Hibernate.initialize(data);
     950        }
     951        catch (org.hibernate.ObjectNotFoundException ex)
     952        {
     953          it.remove();
     954          continue;
     955        }
     956       
    942957        // Found an item of the correct item type... get it's subtype
    943958        ItemSubtypeData otherSubtype = null;
     
    9881003   
    9891004    Class dataClass = itemType.getDataClass();
    990     for (BasicData data : defaultItems.getValues())
    991     {
     1005    Iterator<BasicData> it = defaultItems.getValues().iterator();
     1006    while (it.hasNext())
     1007    {
     1008      BasicData data = it.next();
    9921009      if (dataClass.isInstance(data))
    9931010      {
     1011        // Check if item has been removed
     1012        try
     1013        {
     1014          Hibernate.initialize(data);
     1015        }
     1016        catch (org.hibernate.ObjectNotFoundException ex)
     1017        {
     1018          it.remove();
     1019          continue;
     1020        }
     1021
    9941022        // Found an item of the correct item type... get it's subtype
    9951023        ItemSubtypeData otherSubtype = null;
Note: See TracChangeset for help on using the changeset viewer.