Don't read empty xml elements from the index
This fixes cases where e.g. strings would be "" instead of null. Fixes #285.
This commit is contained in:
parent
f95bfc397d
commit
a7c9be9b16
@ -97,6 +97,7 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
super.endElement(uri, localName, qName);
|
super.endElement(uri, localName, qName);
|
||||||
final String curel = localName;
|
final String curel = localName;
|
||||||
final String str = curchars.toString().trim();
|
final String str = curchars.toString().trim();
|
||||||
|
final boolean empty = (str == null || str.length() == 0);
|
||||||
|
|
||||||
if (curel.equals("application") && curapp != null) {
|
if (curel.equals("application") && curapp != null) {
|
||||||
apps.add(curapp);
|
apps.add(curapp);
|
||||||
@ -112,7 +113,7 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
} else if (curel.equals("package") && curapk != null && curapp != null) {
|
} else if (curel.equals("package") && curapk != null && curapp != null) {
|
||||||
apksList.add(curapk);
|
apksList.add(curapk);
|
||||||
curapk = null;
|
curapk = null;
|
||||||
} else if (curapk != null) {
|
} else if (!empty && curapk != null) {
|
||||||
switch (curel) {
|
switch (curel) {
|
||||||
case "version":
|
case "version":
|
||||||
curapk.version = str;
|
curapk.version = str;
|
||||||
@ -162,7 +163,7 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
curapk.nativecode = Utils.CommaSeparatedList.make(str);
|
curapk.nativecode = Utils.CommaSeparatedList.make(str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (curapp != null) {
|
} else if (!empty && curapp != null) {
|
||||||
switch (curel) {
|
switch (curel) {
|
||||||
case "name":
|
case "name":
|
||||||
curapp.name = str;
|
curapp.name = str;
|
||||||
@ -235,7 +236,7 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
curapp.requirements = Utils.CommaSeparatedList.make(str);
|
curapp.requirements = Utils.CommaSeparatedList.make(str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (curel.equals("description")) {
|
} else if (!empty && curel.equals("description")) {
|
||||||
description = cleanWhiteSpace(str);
|
description = cleanWhiteSpace(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user