fail hashing when using null type or _all

This commit is contained in:
kimchy 2011-07-01 20:23:19 +03:00
parent 0b59c00e0d
commit 317d4f687f
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.cluster.routing.operation.plain;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.routing.GroupShardsIterator;
@ -198,6 +199,9 @@ public class PlainOperationRouting extends AbstractComponent implements Operatio
}
protected int hash(String type, String id) {
if (type == null || "_all".equals(type)) {
throw new ElasticSearchIllegalArgumentException("Can't route an operation with no type and having type part of the routing (for backward comp)");
}
return hashFunction.hash(type, id);
}
}