Clover Coverage Report - Atlassian Trusted Apps(Aggregated)
Coverage timestamp: Tue Jun 9 2009 19:34:44 CDT
13   52   6   4.33
4   42   0.46   3
3     2  
1    
 
 
  ReaderApplicationRetriever       Line # 13 13 6 95% 0.95
 
  (6)
 
1    package com.atlassian.security.auth.trustedapps;
2   
3    import java.io.BufferedReader;
4    import java.io.IOException;
5    import java.io.Reader;
6    import java.util.ArrayList;
7    import java.util.Collections;
8    import java.util.List;
9   
10    /**
11    * Take a Reader and produce an {@link Application}.
12    */
 
13    public class ReaderApplicationRetriever implements ApplicationRetriever
14    {
15    private final ListApplicationRetriever delegate;
16   
 
17  6 toggle public ReaderApplicationRetriever(Reader reader, EncryptionProvider encryptionProvider)
18    {
19  6 Null.not("reader", reader);
20  6 Null.not("encryptionProvider", encryptionProvider);
21   
22  6 this.delegate = new ListApplicationRetriever(encryptionProvider, extract(reader));
23    }
24   
 
25  5 toggle public Application getApplication() throws RetrievalException
26    {
27  5 return delegate.getApplication();
28    }
29   
 
30  6 toggle private List extract(Reader r)
31    {
32  6 BufferedReader reader = new BufferedReader(r);
33  6 final List result = new ArrayList();
34   
35  6 try
36    {
37  17 for (String str = reader.readLine(); str != null; str = reader.readLine())
38    {
39  12 String line = str.trim();
40  12 if (line.length() > 0)
41    {
42  12 result.add(line);
43    }
44    }
45    }
46    catch (IOException e)
47    {
48  1 throw new RuntimeException(e);
49    }
50  5 return Collections.unmodifiableList(result);
51    }
52    }