fix for xml blacklist import

pull/1/head
Michael Peter Christen 12 years ago
parent 7806680ab8
commit ab4f74c82c

@ -44,7 +44,7 @@ public class XMLBlacklistImporter extends DefaultHandler {
private ListAccumulator ba = null; private ListAccumulator ba = null;
private String currentListName = null; private String currentListName = null;
private String lastText = null; private StringBuilder lastText = null;
/** /**
* Takes the input data and turns it into a {@link ListAccumulator} which can * Takes the input data and turns it into a {@link ListAccumulator} which can
@ -141,6 +141,10 @@ public class XMLBlacklistImporter extends DefaultHandler {
} }
} }
if (qName.equalsIgnoreCase("item")) {
lastText = new StringBuilder();
}
} }
/** /**
@ -158,7 +162,7 @@ public class XMLBlacklistImporter extends DefaultHandler {
@Override @Override
public void endElement(final String uri, final String localName, final String qName) throws SAXException { public void endElement(final String uri, final String localName, final String qName) throws SAXException {
if (qName.equalsIgnoreCase("item")) { if (qName.equalsIgnoreCase("item")) {
ba.addEntryToCurrent(lastText); ba.addEntryToCurrent(lastText.toString());
} }
} }
@ -171,7 +175,8 @@ public class XMLBlacklistImporter extends DefaultHandler {
*/ */
@Override @Override
public void characters(char[] ch, int start, int length) throws SAXException { public void characters(char[] ch, int start, int length) throws SAXException {
lastText = new String(ch, start, length); if (lastText == null) lastText = new StringBuilder();
lastText.append(ch, start, length);
} }
} }

Loading…
Cancel
Save