Elliot Shank created NET-532:
--------------------------------

             Summary: NPE in nntp.Threader.thread() when all messages  in a 
derived thread are missing.
                 Key: NET-532
                 URL: https://issues.apache.org/jira/browse/NET-532
             Project: Commons Net
          Issue Type: Bug
          Components: NNTP
    Affects Versions: 3.3, 3.0
            Reporter: Elliot Shank


I'm threading emails using the References: header. When I've got an incomplete 
set of messages (in this specific case, it's from one of the C++ standards 
committee lists) such that I'm missing an entire thread, I get exceptions like 
this:

Exception in thread "main" java.lang.NullPointerException
     at org.apache.commons.net.nntp.Threader.gatherSubjects(Threader.java:342)
     at org.apache.commons.net.nntp.Threader.thread(Threader.java:81)
     at org.apache.commons.net.nntp.Threader.thread(Threader.java:47)

What happens is that the graph returned by findRootSet() at line 71 will look 
something like

     ...
     <ThreadContainer A with Threadable>
         ...
     <ThreadContainer B without Threadable>
         <ThreadContainer ... without Threadable>
             <ThreadContainer ... without Threadable>
             <ThreadContainer ... without Threadable>
         <ThreadContainer ... without Threadable>
             <ThreadContainer ... without Threadable>
                 <ThreadContainer ... without Threadable>
     <ThreadContainer C with Threadable>
         ...
     ...

And, after pruneEmptyContainers() has had its way with things on line 75, the 
graph will be

     ...
     <ThreadContainer A with Threadable>
         ...
     <ThreadContainer B without Threadable>
     <ThreadContainer C with Threadable>
         ...
     ...

when it should be

     ...
     <ThreadContainer A with Threadable>
         ...
     <ThreadContainer C with Threadable>
         ...
     ...

I.e., ThreadContainer B should be eliminated entirely.

As it is, with ThreadContainer B present, but not containing any children or a 
Threadable, gatherSubjects() chokes.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to