Closed
Description
For a test that checks error messages when limit value is less than a positive value, the error message shows the limit variable name; prints the variable name ("length") and the message twice.
For the above test in Java (given below):
Map<String, Object>[] literals1 = new HashMap[5];
Map<String, Object>[] literals2 = new HashMap[4];
...
...
Map<String, Object> row = new HashMap<>();
row.put("rowId", 1); row.put("colorId", 1); row.put("desc", "ball");
literals1[0] = row;
row = new HashMap<>();
row.put("rowId", 2); row.put("colorId", 2); row.put("desc", "square");
literals1[1] = row;
row = new HashMap<>();
row.put("rowId", 3); row.put("colorId", 1); row.put("desc", "box");
literals1[2] = row;
row = new HashMap<>();
row.put("rowId", 4); row.put("colorId", 1); row.put("desc", "hoop");
literals1[3] = row;
row = new HashMap<>();
row.put("rowId", 5); row.put("colorId", 5); row.put("desc", "circle");
literals1[4] = row;
row = new HashMap<>();
row.put("colorId", 1); row.put("colorDesc", "red");
literals2[0] = row;
row = new HashMap<>();
row.put("colorId", 2); row.put("colorDesc", "blue");
literals2[1] = row;
row = new HashMap<>();
row.put("colorId", 3); row.put("colorDesc", "black");
literals2[2] = row;
row = new HashMap<>();
row.put("colorId", 4); row.put("colorDesc", "yellow");
literals2[3] = row;
...
// Create a new Plan.
RowManager rowMgr = client.newRowManager();
PlanBuilder p = rowMgr.newPlanBuilder();
// plans from literals
ModifyPlan plan1 = p.fromLiterals(literals1);
ModifyPlan plan2 = p.fromLiterals(literals2);
...
...
//limit with 0 length
ModifyPlan outputLimit = plan1.joinInner(plan2)
.where(p.eq(p.col("colorId"), p.xs.intVal(1)))
.limit(0)
.select("rowId", "desc", "colorId", "colorDesc");
JacksonHandle jacksonHandle = new JacksonHandle();
jacksonHandle.setMimetype("application/json");
StringBuilder str = new StringBuilder();
try {
rowMgr.resultDoc(outputLimit, jacksonHandle);
}
catch(Exception ex) {
str.append(ex.getMessage());
}
The message is:
com.marklogic.client.FailedRequestException: Local message: failed to apply resource at rows: Bad Request. Server Message: OPTIC-INVALARGS: fn.error(null, 'OPTIC-INVALARGS', 'limit must be a positive number: '+length); -- Invalid arguments: limit must be a positive number: 0
The following text needs to be removed.
limit must be a positive number: '+length