}
private ArrayProperties buildArrayProperties() throws MethodIsBlockingException {
ObjectProperties loadedProperties = getLoadedProperties();
final TreeMap<Long, JsVariable> map = new TreeMap<Long, JsVariable>();
JsValue lengthValue = null;
for (JsVariable variable : loadedProperties.properties()) {
String name = variable.getName();
Long index = JavaScriptExpressionBuilder.parsePropertyNameAsArrayIndex(name);
if (index != null) {
map.put(index, variable);
} else if ("length".equals(name)) {
lengthValue = variable.getValue();
}
}
long length;
try {
length = Long.parseLong(lengthValue.getValueString());
} catch (NumberFormatException e) {
length = -1;
}
return new ArrayProperties(length, map);
}