Clover Coverage Report - Subsonic-Android Coverage Report
Coverage timestamp: ven dic 19 2014 17:57:13 EST
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
18   69   6   9
8   36   0,33   2
2     3  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  MusicFoldersParser       Line # 36 18 6 92,9% 0.9285714
 
No Tests
 
1    /*
2    This file is part of Subsonic.
3   
4    Subsonic is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8   
9    Subsonic is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12    GNU General Public License for more details.
13   
14    You should have received a copy of the GNU General Public License
15    along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
16   
17    Copyright 2009 (C) Sindre Mehus
18    */
19    package net.sourceforge.subsonic.androidapp.service.parser;
20   
21    import java.io.Reader;
22    import java.util.ArrayList;
23    import java.util.List;
24   
25    import org.xmlpull.v1.XmlPullParser;
26   
27    import android.content.Context;
28    import net.sourceforge.subsonic.androidapp.R;
29    import net.sourceforge.subsonic.androidapp.domain.MusicFolder;
30    import net.sourceforge.subsonic.androidapp.domain.Playlist;
31    import net.sourceforge.subsonic.androidapp.util.ProgressListener;
32   
33    /**
34    * @author Sindre Mehus
35    */
 
36    public class MusicFoldersParser extends AbstractParser {
37   
 
38  2 toggle public MusicFoldersParser(Context context) {
39  2 super(context);
40    }
41   
 
42  2 toggle public List<MusicFolder> parse(Reader reader, ProgressListener progressListener) throws Exception {
43   
44  2 updateProgress(progressListener, R.string.parser_reading);
45  2 init(reader);
46   
47  2 List<MusicFolder> result = new ArrayList<MusicFolder>();
48  2 int eventType;
49  2 do {
50  22 eventType = nextParseEvent();
51  22 if (eventType == XmlPullParser.START_TAG) {
52  6 String tag = getElementName();
53  6 if ("musicFolder".equals(tag)) {
54  2 String id = get("id");
55  2 String name = get("name");
56  2 result.add(new MusicFolder(id, name));
57  4 } else if ("error".equals(tag)) {
58  0 handleError();
59    }
60    }
61  22 } while (eventType != XmlPullParser.END_DOCUMENT);
62   
63  2 validate();
64  2 updateProgress(progressListener, R.string.parser_reading_done);
65   
66  2 return result;
67    }
68   
69    }