Ignore:
Timestamp:
Sep 5, 2007, 11:29:16 AM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #740: Missing AnyToAny? item causes ItemNotFoundException? when viewing a transformation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4-stable/www/common/anytoany/edit_anytoany.jsp

    r3675 r3707  
    3737  import="net.sf.basedb.core.Nameable"
    3838  import="net.sf.basedb.core.PermissionDeniedException"
     39  import="net.sf.basedb.core.ItemNotFoundException"
    3940  import="net.sf.basedb.clients.web.Base"
    4041  import="net.sf.basedb.clients.web.util.HTML"
     
    4445<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
    4546<%!
    46 private String getName(BasicItem item, boolean readItem)
     47private String getName(BasicItem item, boolean readItem, boolean missingItem, Item itemType, int id)
    4748{
    4849  String name = "";
     
    6061  {
    6162    name = "<i>- denied -</i>";
     63  }
     64  else if (missingItem)
     65  {
     66    name = "<i>- missing -</i> (" + itemType.toString() + "; id=" + id + ")";
    6267  }
    6368  else if (item == null)
     
    105110    BasicItem to = null;
    106111    boolean readTo = true;
     112    boolean missingTo = false;
    107113   
    108114    BasicItem from = null;
    109115    boolean readFrom = true;
     116    boolean missingFrom = false;
    110117   
    111118    try
     
    117124      readTo = false;
    118125    }
     126    catch (ItemNotFoundException ex)
     127    {
     128      missingTo = true;
     129    }
    119130   
    120131    try
     
    126137      readFrom = false;
    127138    }
    128    
    129     toName = getName(to, readTo);
    130     fromName = getName(from, readFrom);
     139    catch (ItemNotFoundException ex)
     140    {
     141      missingFrom = true;
     142    }
     143 
     144    toName = getName(to, readTo, missingTo, anyToAny.getToType(), anyToAny.getToId());
     145    fromName = getName(from, readFrom, missingFrom, anyToAny.getFromType(), anyToAny.getFromId());
    131146  }
    132147  if (anyToAny != null) anyToAny.checkPermission(Permission.WRITE);
Note: See TracChangeset for help on using the changeset viewer.