Simplify code by creating the object when required rather than using singleton.

This should not be a particularly expensive opperation,. Also, at time of
writing it is only used in a background thread, and only used once in that
thread (i.e. not in a loop or anything like that).
This commit is contained in:
Peter Serwylo 2016-06-02 14:46:58 +10:00
parent 371312ef65
commit a74e951cdf

View File

@ -319,16 +319,6 @@ public final class LocalRepoManager {
* Helper class to aid in constructing index.xml file.
*/
public static final class IndexXmlBuilder {
private static IndexXmlBuilder indexXmlBuilder;
public static IndexXmlBuilder get() throws XmlPullParserException {
if (indexXmlBuilder == null) {
indexXmlBuilder = new IndexXmlBuilder();
}
return indexXmlBuilder;
}
@NonNull
private final XmlSerializer serializer;
@ -487,7 +477,7 @@ public final class LocalRepoManager {
JarOutputStream jo = new JarOutputStream(bo);
JarEntry je = new JarEntry("index.xml");
jo.putNextEntry(je);
IndexXmlBuilder.get().build(context, apps, jo);
new IndexXmlBuilder().build(context, apps, jo);
jo.close();
bo.close();