hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1497211 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/rest/RowResource.java test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
Date Thu, 27 Jun 2013 05:06:29 GMT
Author: apurtell
Date: Thu Jun 27 05:06:29 2013
New Revision: 1497211

URL: http://svn.apache.org/r1497211
Log:
HBASE-8811. REST service ignores misspelled 'check' parameter, causing unexpected mutations
(Chip Salzenberg and Andrew Purtell)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java?rev=1497211&r1=1497210&r2=1497211&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java Thu Jun
27 05:06:29 2013
@@ -181,7 +181,9 @@ public class RowResource extends Resourc
     } 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();

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java?rev=1497211&r1=1497210&r2=1497211&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java Thu
Jun 27 05:06:29 2013
@@ -667,6 +667,23 @@ 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);
+  }
+
   @org.junit.Rule
   public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
     new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();



Mime
View raw message