hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1497210 - in /hbase/branches/0.95/hbase-server/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:05:29 GMT
Author: apurtell
Date: Thu Jun 27 05:05:28 2013
New Revision: 1497210

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

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

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java?rev=1497210&r1=1497209&r2=1497210&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
Thu Jun 27 05:05:28 2013
@@ -182,7 +182,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.95/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java?rev=1497210&r1=1497209&r2=1497210&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
Thu Jun 27 05:05:28 2013
@@ -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);
+  }
+
 }
 



Mime
View raw message