Use a stub 'AuctionInfo' object, when we can't actually retrieve a real one, so that dozens of methods don't throw NPE's randomly in the moments when an auction is deleted, but the UI is trying to display the entry.

by mrs, 10 Oct, 2009 11:22 PM
1013 1021  
14771477     return r_flags;
14781478   }
14791479 
1480   private static AuctionInfo sAuction = new AuctionInfo();
1481 
14801482   public AuctionInfo getAuction() {
1481     if(mAuction == null) {
1483     if(mAuction == null || mAuction == sAuction) {
14821484       String aid = get("auction_id");
14831485       if(aid != null && aid.length() != 0) {
14841486         mAuction = AuctionInfo.findFirstBy("id", aid);
14851487       }
1486       if(mAuction == null && getString("identifier") != null) {
1488       if((mAuction == null || mAuction == sAuction) && getString("identifier") != null) {
14871489         mAuction = AuctionInfo.findByIdentifier(getString("identifier"));
14881490       }
14891491 
------
14991501       }
15001502     }
15011503 
1504     if(mAuction == null) mAuction = sAuction;
1505 
15021506     return mAuction;
15031507   }
15041508 
------
15101514    * @param inAI - The AuctionInfo object to make the new core data.  Must not be null.
15111515    */
15121516   public void setAuctionInfo(AuctionInfo inAI) {
1513     if(mAuction == null) {
1517     if(mAuction == null || mAuction == sAuction) {
15141518       setDefaultCurrency(inAI.getDefaultCurrency());
15151519     }
15161520 
------
16821686   /*************************/
16831687 
16841688   public String saveDB() {
1685     if(mAuction == null) return null;
1689     if(mAuction == null || mAuction == sAuction) return null;
16861690 
16871691     String auctionId = mAuction.saveDB();
16881692     if(auctionId != null) set("auction_id", auctionId);