Fix crash size is missing in bitset

This commit is contained in:
Victor Shcherb 2017-04-16 13:49:19 +03:00
parent c88e47b710
commit 7113eb554f

View file

@ -687,7 +687,7 @@ public class GeneralRouter implements VehicleRouter {
if (value instanceof String && value.toString().startsWith("$")) { if (value instanceof String && value.toString().startsWith("$")) {
BitSet mask = tagRuleMask.get(value.toString().substring(1)); BitSet mask = tagRuleMask.get(value.toString().substring(1));
if (mask != null && mask.intersects(types)) { if (mask != null && mask.intersects(types)) {
BitSet findBit = new BitSet(mask.size()); BitSet findBit = new BitSet(mask.length());
findBit.or(mask); findBit.or(mask);
findBit.and(types); findBit.and(types);
int v = findBit.nextSetBit(0); int v = findBit.nextSetBit(0);
@ -768,16 +768,16 @@ public class GeneralRouter implements VehicleRouter {
public void printRule(PrintStream out) { public void printRule(PrintStream out) {
out.print(" Select " + selectValue + " if "); out.print(" Select " + selectValue + " if ");
for(int k = 0; k < filterTypes.size(); k++) { for(int k = 0; k < filterTypes.length(); k++) {
if(filterTypes.get(k)) { if(filterTypes.get(k)) {
String key = universalRulesById.get(k); String key = universalRulesById.get(k);
out.print(key + " "); out.print(key + " ");
} }
} }
if(filterNotTypes.size() > 0) { if(filterNotTypes.length() > 0) {
out.print(" ifnot "); out.print(" ifnot ");
} }
for(int k = 0; k < filterNotTypes.size(); k++) { for(int k = 0; k < filterNotTypes.length(); k++) {
if(filterNotTypes.get(k)) { if(filterNotTypes.get(k)) {
String key = universalRulesById.get(k); String key = universalRulesById.get(k);
out.print(key + " "); out.print(key + " ");
@ -850,7 +850,7 @@ public class GeneralRouter implements VehicleRouter {
if (selectValue instanceof String && selectValue.toString().startsWith("$")) { if (selectValue instanceof String && selectValue.toString().startsWith("$")) {
BitSet mask = tagRuleMask.get(selectValue.toString().substring(1)); BitSet mask = tagRuleMask.get(selectValue.toString().substring(1));
if (mask != null && mask.intersects(types)) { if (mask != null && mask.intersects(types)) {
BitSet findBit = new BitSet(mask.size()); BitSet findBit = new BitSet(mask.length());
findBit.or(mask); findBit.or(mask);
findBit.and(types); findBit.and(types);
int value = findBit.nextSetBit(0); int value = findBit.nextSetBit(0);