#fixed code
                             @Test
	public void testPutRange() throws Exception
	{
		final HttpClientBuilder client = HttpClientBuilder.create();
		client.addInterceptorFirst(new HttpResponseInterceptor()
		{
			public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
			{
				assertEquals(201, r.getStatusLine().getStatusCode());
			}
		});
		Sardine sardine = new SardineImpl(client);
		// mod_dav supports Range headers for PUT
		final String url = "http://sudo.ch/dav/anon/sardine/" + UUID.randomUUID().toString();
		sardine.put(url, new ByteArrayInputStream("Te".getBytes("UTF-8")));
		try
		{
			// Append to existing file
			final Map<String, String> header = Collections.singletonMap(HttpHeaders.CONTENT_RANGE,
					"bytes " + 2 + "-" + 3 + "/" + 4);

			client.addInterceptorFirst(new HttpRequestInterceptor()
			{
				public void process(final HttpRequest r, final HttpContext context) throws HttpException, IOException
				{
					assertNotNull(r.getHeaders(HttpHeaders.CONTENT_RANGE));
					assertEquals(1, r.getHeaders(HttpHeaders.CONTENT_RANGE).length);
				}
			});
			client.addInterceptorFirst(new HttpResponseInterceptor()
			{
				public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
				{
					assertEquals(204, r.getStatusLine().getStatusCode());
				}
			});
			sardine.put(url, new ByteArrayInputStream("st".getBytes("UTF-8")), header);

			assertEquals("Test", new BufferedReader(new InputStreamReader(sardine.get(url), "UTF-8")).readLine());
		}
		finally
		{
			sardine.delete(url);
		}
	}
#vulnerable code 
                             @Test
	public void testPutRange() throws Exception
	{
		final DefaultHttpClient client = new DefaultHttpClient();
		Sardine sardine = new SardineImpl(client);
		// mod_dav supports Range headers for PUT
		final String url = "http://sudo.ch/dav/anon/sardine/" + UUID.randomUUID().toString();
		client.addResponseInterceptor(new HttpResponseInterceptor()
		{
			public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
			{
				assertEquals(201, r.getStatusLine().getStatusCode());
				client.removeResponseInterceptorByClass(this.getClass());
			}
		});
		sardine.put(url, new ByteArrayInputStream("Te".getBytes("UTF-8")));

		try
		{
			// Append to existing file
			final Map<String, String> header = Collections.singletonMap(HttpHeaders.CONTENT_RANGE,
					"bytes " + 2 + "-" + 3 + "/" + 4);

			client.addRequestInterceptor(new HttpRequestInterceptor()
			{
				public void process(final HttpRequest r, final HttpContext context) throws HttpException, IOException
				{
					assertNotNull(r.getHeaders(HttpHeaders.CONTENT_RANGE));
					assertEquals(1, r.getHeaders(HttpHeaders.CONTENT_RANGE).length);
					client.removeRequestInterceptorByClass(this.getClass());
				}
			});
			client.addResponseInterceptor(new HttpResponseInterceptor()
			{
				public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
				{
					assertEquals(204, r.getStatusLine().getStatusCode());
					client.removeResponseInterceptorByClass(this.getClass());
				}
			});
			sardine.put(url, new ByteArrayInputStream("st".getBytes("UTF-8")), header);

			assertEquals("Test", new BufferedReader(new InputStreamReader(sardine.get(url), "UTF-8")).readLine());
		}
		finally
		{
			sardine.delete(url);
		}
	} 
                            #location 47 
                            #vulnerability type RESOURCE_LEAK