Changeset 68

Show
Ignore:
Timestamp:
11/12/05 23:22:41 (5 years ago)
Author:
dsandler
Message:

See ticket #14. We now only inject feed exceptions into the user's view of
the feed if the exception occurs twice in a row.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedtree/trunk/src/net/feedtree/proxyapp/FeedInfo.java

    r40 r68  
    232232    protected SyndFeedOutput m_feedOutput = new SyndFeedOutput(); 
    233233    protected Exception     m_errno; 
     234    protected int           m_errCount; 
    234235    protected Date          m_nextTaskDate; 
    235236    protected Date          m_lastTaskDate; 
     
    344345        Exception err = m_errno; 
    345346        m_errno = null; 
     347        m_errCount = 0; 
    346348        return err; 
     349    } 
     350 
     351    protected void setFeedException(Exception e) { 
     352        m_errno = e; 
     353        m_errCount++; 
     354    } 
     355 
     356    protected void clearFeedException() { 
     357        m_errno = null; 
     358        m_errCount = 0; 
    347359    } 
    348360 
    349361    public Exception peekLastException() { 
    350362        return m_errno; 
     363    } 
     364     
     365    public int peekLastExceptionCount() { 
     366        return m_errCount; 
    351367    } 
    352368     
     
    493509                 
    494510                if (newEvent) newEntries.add(event); 
     511 
     512                clearFeedException(); 
    495513            } catch (com.sun.syndication.io.FeedException exc) { 
    496514                // not much we can do---the thing doesn't generate. 
    497515                Logger.global.warning("Couldn't convert SyndEntry (" + entry + ") to IFeedEvent: " + exc); 
    498                 m_errno = exc
     516                setFeedException(exc)
    499517            } 
    500518        } 
     
    527545            // Observer: WebProxyClient. 
    528546            // Note: if newEvents.size() == 0, a heartbeat will be generated 
     547 
     548            clearFeedException(); 
     549             
    529550        } catch (Exception e) { 
    530551            Logger.global.warning(">> Couldn't fetch feed " + m_uri + ": " + e); 
    531552            e.printStackTrace(System.out); 
    532553             
    533             m_errno = e
     554            setFeedException(e)
    534555            // will result in an RSS item for the user explaining the 
    535556            // exception 
  • feedtree/trunk/src/net/feedtree/proxyapp/WebProxyClient.java

    r67 r68  
    5757     
    5858    public static long DEFAULT_STALE_FEED_AGE = 7 * DAYS; 
     59 
     60    // Number of times an exception must be raised in sequence before it's 
     61    // reported to the user as a fake RSS item 
     62    public static int TRANSIENT_EXCEPTION_THRESH = 2; 
    5963 
    6064    public static String FEEDTREE_CLIENT_FEED_TYPE = "atom_0.3"; 
     
    382386                SyndFeed generatedFeed = feed.generateSyndFeed(WebProxyClient.FEED_SIZE, m_appendEntryInfo); 
    383387                 
    384                 if (feed.peekLastException() != null) { 
     388                if (feed.peekLastException() != null  
     389                && feed.peekLastExceptionCount() >= TRANSIENT_EXCEPTION_THRESH)  
     390                { 
    385391                    ListIterator iter = generatedFeed.getEntries().listIterator(); 
    386392