diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java index 00aea0a3efbd5..ec291f845b313 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java @@ -546,7 +546,7 @@ public GetBlobPropertiesResult getBlobProperties(String container, String blob, builder = addOptionalAccessContitionHeader(builder, options.getAccessCondition()); ClientResponse response = builder.method("HEAD", ClientResponse.class); - ThrowIfError(response); + ThrowIfNotSuccess(response); return getBlobPropertiesResultFromResponse(response); } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java index 76146812ed985..a72111d7853b6 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java @@ -1259,6 +1259,24 @@ public void getBlobPropertiesWorks() throws Exception { assertEquals(0, props.getSequenceNumber()); } + @Test(expected = ServiceException.class) + public void getBlobPropertiesIfNotModified() throws Exception { + // Arrange + Configuration config = createConfiguration(); + BlobContract service = BlobService.create(config); + Date currentLastModifiedDate = new Date(); + + // Act + String container = TEST_CONTAINER_FOR_BLOBS; + String blob = "test"; + service.createPageBlob(container, blob, 4096); + GetBlobPropertiesResult result = service.getBlobProperties(container, blob, new GetBlobPropertiesOptions() + .setAccessCondition(AccessCondition.ifModifiedSince(currentLastModifiedDate))); + + // Assert + assertTrue(false); + } + @Test public void getBlobMetadataWorks() throws Exception { // Arrange