avatar

605

Don't try to load the auctions xml file if we didn't create the database this run. In other words, only the first time we load JBidwatcher as an upgrade should we try to import the auctions.

by mrs, 14 Aug, 2008 05:54 PM
579 605  
8282   private static final int HOURS_IN_DAY = 24;
8383   private static final int MINUTES_IN_HOUR = 60;
8484   private static boolean sUSB = false;
85   private static boolean sCreatedDB = false;
8586 
8687   /**
8788    * @brief Try to guarantee a directory for saving 'cached copies'
------
396397     setUI(null, null, UIManager.getInstalledLookAndFeels());
397398 
398399     try {
400       boolean creatingDB = JConfig.queryConfiguration("jbidwatcher.created_db", "false").equals("false");
399401       Upgrader.upgrade();
402       if(creatingDB && JConfig.queryConfiguration("jbidwatcher.created_db", "false").equals("true")) {
403         sCreatedDB = true;
404       }
400405     } catch(Exception e) {
401406       if (e.getMessage().matches("^Failed to start database.*")) {
402407         JOptionPane.showMessageDialog(null, "JBidwatcher can't access its database.\nPlease check to see if you are running another instance.", "Can't access auction database", JOptionPane.PLAIN_MESSAGE);
------
543548     Initializer.setup();
544549     FilterManager.getInstance().loadFilters();
545550     inSplash.message("Loading Auctions");
546     if (AuctionsManager.getInstance().loadAuctionsFromDatabase() == 0) {
551     if (sCreatedDB) {
547552       AuctionsManager.getInstance().loadAuctions();
553     } else {
554       AuctionsManager.getInstance().loadAuctionsFromDatabase();
548555     }
549556 
550557     AuctionServerManager.getInstance().getDefaultServerTime();
590 605  
8484   }
8585 
8686   public static List<EventStatus> findAllByEntry(Integer entryId, String identifier) {
87     if(entryId == null) return null;
8788     List<ActiveRecord> records = ActiveRecord.findAllBy(EventStatus.class, "entry_id", Integer.toString(entryId), "created_at ASC");
8889 
8990     if(records != null) {