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
21   71   7   10,5
10   38   0,33   2
2     3,5  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  MusicDirectoryParser       Line # 33 21 7 93,9% 0.93939394
 
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 android.content.Context;
22    import android.util.Log;
23    import net.sourceforge.subsonic.androidapp.R;
24    import net.sourceforge.subsonic.androidapp.domain.MusicDirectory;
25    import net.sourceforge.subsonic.androidapp.util.ProgressListener;
26    import org.xmlpull.v1.XmlPullParser;
27   
28    import java.io.Reader;
29   
30    /**
31    * @author Sindre Mehus
32    */
 
33    public class MusicDirectoryParser extends MusicDirectoryEntryParser {
34   
35    private static final String TAG = MusicDirectoryParser.class.getSimpleName();
36   
 
37  5 toggle public MusicDirectoryParser(Context context) {
38  5 super(context);
39    }
40   
 
41  5 toggle public MusicDirectory parse(Reader reader, ProgressListener progressListener) throws Exception {
42   
43  5 long t0 = System.currentTimeMillis();
44  5 updateProgress(progressListener, R.string.parser_reading);
45  5 init(reader);
46   
47  5 MusicDirectory dir = new MusicDirectory();
48  5 int eventType;
49  5 do {
50  163 eventType = nextParseEvent();
51  163 if (eventType == XmlPullParser.START_TAG) {
52  51 String name = getElementName();
53  51 if ("child".equals(name)) {
54  41 dir.addChild(parseEntry());
55  10 } else if ("directory".equals(name)) {
56  5 dir.setName(get("name"));
57  5 } else if ("error".equals(name)) {
58  0 handleError();
59    }
60    }
61  163 } while (eventType != XmlPullParser.END_DOCUMENT);
62   
63  5 validate();
64  5 updateProgress(progressListener, R.string.parser_reading_done);
65   
66  5 long t1 = System.currentTimeMillis();
67  5 Log.d(TAG, "Got music directory in " + (t1 - t0) + "ms.");
68   
69  5 return dir;
70    }
71    }