avoid null keys in indices

This commit is contained in:
sweinreuter
2010-11-10 12:35:12 +01:00
parent ca13c5c5e0
commit fcff21d17f
2 changed files with 6 additions and 3 deletions
@@ -88,7 +88,7 @@ public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
attributeHandler = new NanoXmlUtil.IXMLBuilderAdapter() {
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
if ("name".equals(key) && (nsURI == null || nsURI.length() == 0)) {
if ("name".equals(key) && (nsURI == null || nsURI.length() == 0) && value != null) {
map.put(value, null);
}
}
@@ -112,7 +112,10 @@ public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
grammar.acceptChildren(new CommonElement.Visitor() {
@Override
public void visitDefine(Define define) {
map.put(define.getName(), null);
final String name = define.getName();
if (name != null) {
map.put(name, null);
}
}
});
}
@@ -181,7 +181,7 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
if (key.equals("name") && (nsURI == null || nsURI.length() == 0)) {
if (key.equals("name") && (nsURI == null || nsURI.length() == 0) && value != null) {
if (myMap.put(value, myKind) != null) {
myMap.put(value, Kind.ANYTHING);
}