Changeset 7582

Show
Ignore:
Timestamp:
04/06/09 12:55:42 (17 months ago)
Author:
dragisak
Message:

Add checks to prevent loosing annotation body during conversion. Addresses #1108

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • head/ambra/webapp/src/main/java/org/topazproject/ambra/annotation/service/AnnotationService.java

    r7360 r7582  
    3737import org.springframework.transaction.annotation.Transactional; 
    3838 
     39import org.topazproject.ambra.ApplicationException; 
    3940import org.topazproject.ambra.Constants; 
    4041import org.topazproject.ambra.annotation.FlagUtil; 
     
    600601    } 
    601602 
     603    // Trying to catch #1108 
     604    if (srcAnnotation.getBody() == null) 
     605      throw new ApplicationException("Trying to copy annotation " + srcAnnotationId + 
     606          " that has NULL body"); 
     607 
    602608    ArticleAnnotation newAn = newAnnotationClassType.newInstance(); 
    603609    synchronized (beanUtils) { 
     
    608614    session.delete(srcAnnotation); 
    609615    session.flush(); 
     616 
     617    // Trying to catch #1108 
     618    if (newAn.getBody() == null) 
     619      throw new ApplicationException("Trying to save annotation " + newAn.getId().toString() 
     620          + " with NULL body"); 
    610621 
    611622    return session.saveOrUpdate(newAn); // Should return value equal to srcAnnotationId