HBASE-8811. REST service ignores misspelled 'check' parameter, causing unexpected mutations (Chip Salzenberg and Andrew Purtell)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1497209 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5eea46314
commit
c04cad9e7d
|
@ -182,7 +182,9 @@ public class RowResource extends ResourceBase {
|
|||
} else if (CHECK_DELETE.equalsIgnoreCase(check)) {
|
||||
return checkAndDelete(model);
|
||||
} else if (check != null && check.length() > 0) {
|
||||
LOG.warn("Unknown check value: " + check + ", ignored");
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.type(MIMETYPE_TEXT).entity("Invalid check value '" + check + "'" + CRLF)
|
||||
.build();
|
||||
}
|
||||
|
||||
HTablePool pool = servlet.getTablePool();
|
||||
|
|
|
@ -699,5 +699,22 @@ public class TestRowResource {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidCheckParam() throws IOException, JAXBException {
|
||||
CellSetModel cellSetModel = new CellSetModel();
|
||||
RowModel rowModel = new RowModel(ROW_1);
|
||||
rowModel.addCell(new CellModel(Bytes.toBytes(COLUMN_1),
|
||||
Bytes.toBytes(VALUE_1)));
|
||||
cellSetModel.addRow(rowModel);
|
||||
StringWriter writer = new StringWriter();
|
||||
marshaller.marshal(cellSetModel, writer);
|
||||
|
||||
final String path = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1 + "?check=blah";
|
||||
|
||||
Response response = client.put(path, Constants.MIMETYPE_XML,
|
||||
Bytes.toBytes(writer.toString()));
|
||||
assertEquals(response.getCode(), 400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue