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:
parent
371312ef65
commit
a74e951cdf
@ -319,16 +319,6 @@ public final class LocalRepoManager {
|
|||||||
* Helper class to aid in constructing index.xml file.
|
* Helper class to aid in constructing index.xml file.
|
||||||
*/
|
*/
|
||||||
public static final class IndexXmlBuilder {
|
public static final class IndexXmlBuilder {
|
||||||
|
|
||||||
private static IndexXmlBuilder indexXmlBuilder;
|
|
||||||
|
|
||||||
public static IndexXmlBuilder get() throws XmlPullParserException {
|
|
||||||
if (indexXmlBuilder == null) {
|
|
||||||
indexXmlBuilder = new IndexXmlBuilder();
|
|
||||||
}
|
|
||||||
return indexXmlBuilder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final XmlSerializer serializer;
|
private final XmlSerializer serializer;
|
||||||
|
|
||||||
@ -487,7 +477,7 @@ public final class LocalRepoManager {
|
|||||||
JarOutputStream jo = new JarOutputStream(bo);
|
JarOutputStream jo = new JarOutputStream(bo);
|
||||||
JarEntry je = new JarEntry("index.xml");
|
JarEntry je = new JarEntry("index.xml");
|
||||||
jo.putNextEntry(je);
|
jo.putNextEntry(je);
|
||||||
IndexXmlBuilder.get().build(context, apps, jo);
|
new IndexXmlBuilder().build(context, apps, jo);
|
||||||
jo.close();
|
jo.close();
|
||||||
bo.close();
|
bo.close();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user