more npe fixes
This commit is contained in:
parent
5db04a37bd
commit
66bb5c9b51
|
@ -56,10 +56,12 @@ public class Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStart(String needle) {
|
public boolean isStart(String needle) {
|
||||||
|
if (needle==null) return false;
|
||||||
return (this.type == START) && (needle.equals(this.name));
|
return (this.type == START) && (needle.equals(this.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnd(String needle) {
|
public boolean isEnd(String needle) {
|
||||||
|
if (needle==null) return false;
|
||||||
return (this.type == END) && (needle.equals(this.name));
|
return (this.type == END) && (needle.equals(this.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,16 @@ public class XmlReader {
|
||||||
Element element = new Element(currentTag.getName());
|
Element element = new Element(currentTag.getName());
|
||||||
element.setAttributes(currentTag.getAttributes());
|
element.setAttributes(currentTag.getAttributes());
|
||||||
Tag nextTag = this.readTag();
|
Tag nextTag = this.readTag();
|
||||||
|
if (nextTag == null) {
|
||||||
|
throw new IOException("unterupted mid tag");
|
||||||
|
}
|
||||||
if(nextTag.isNo()) {
|
if(nextTag.isNo()) {
|
||||||
element.setContent(nextTag.getName());
|
element.setContent(nextTag.getName());
|
||||||
nextTag = this.readTag();
|
nextTag = this.readTag();
|
||||||
}
|
|
||||||
if (nextTag == null) {
|
if (nextTag == null) {
|
||||||
throw new IOException("unterupted mid tag");
|
throw new IOException("unterupted mid tag");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while(!nextTag.isEnd(element.getName())) {
|
while(!nextTag.isEnd(element.getName())) {
|
||||||
if (!nextTag.isNo()) {
|
if (!nextTag.isNo()) {
|
||||||
Element child = this.readElement(nextTag);
|
Element child = this.readElement(nextTag);
|
||||||
|
|
Loading…
Reference in a new issue