THRIFT-1282. java: Upgrade httpclient to 4.1.2 (from 4.0.1) 

Patch: Aravind Srini

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1160941 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/build.xml b/lib/java/build.xml
index 7b4e8dd..51df768 100644
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -92,7 +92,9 @@
 
   <target name="compile" depends="init">
     <javac srcdir="${src}" destdir="${build.dir}" source="1.5" target="1.5" 
-    debug="true" classpathref="compile.classpath" includeantruntime="false"/>
+    debug="true" classpathref="compile.classpath" includeantruntime="false">
+      <compilerarg value="-Xlint:deprecation"/>
+    </javac>
   </target>
 
   <target name="javadoc" depends="init">
@@ -146,9 +148,15 @@
   </target>
 
   <target name="compile-test" description="Build the test suite classes" depends="generate,dist">
-    <javac debug="true" srcdir="${gen}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false"/>
-    <javac debug="true" srcdir="${genbean}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false"/>
-    <javac debug="true" srcdir="${src.test}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false"/>
+    <javac debug="true" srcdir="${gen}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false">
+        <compilerarg value="-Xlint:deprecation"/>
+    </javac>  
+    <javac debug="true" srcdir="${genbean}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false">
+     <compilerarg value="-Xlint:deprecation"/>  
+    </javac>  
+    <javac debug="true" srcdir="${src.test}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false">
+     <compilerarg value="-Xlint:deprecation"/>
+    </javac>  
     <copy todir="${build.test.dir}">
       <fileset dir="${src.test}" includes="log4j.properties"/>
     </copy>
@@ -290,7 +298,8 @@
       <dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.5.8"/>
       <dependency groupId="commons-lang" artifactId="commons-lang" version="2.5"/>
       <dependency groupId="javax.servlet" artifactId="servlet-api" version="2.5"/>
-      <dependency groupId="org.apache.httpcomponents" artifactId="httpclient" version="4.0.1"/>
+      <dependency groupId="org.apache.httpcomponents" artifactId="httpclient" version="4.1.2"/>      
+      <dependency groupId="org.apache.httpcomponents" artifactId="httpcore" version="4.1.3"/>
     </artifact:pom>
 
     <!-- Generate the pom file -->
diff --git a/lib/java/src/org/apache/thrift/transport/THttpClient.java b/lib/java/src/org/apache/thrift/transport/THttpClient.java
index b16da68..30f59ee 100644
--- a/lib/java/src/org/apache/thrift/transport/THttpClient.java
+++ b/lib/java/src/org/apache/thrift/transport/THttpClient.java
@@ -36,6 +36,7 @@
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.util.EntityUtils;
 
 /**
  * HTTP implementation of the TTransport interface. Used for working with a
@@ -265,7 +266,7 @@
       
       try {
         // Indicate we're done with the content.
-        response.getEntity().consumeContent();
+        EntityUtils.consume(response.getEntity());
       } catch (IOException ioe) {
         // We ignore this exception, it might only mean the server has no
         // keep-alive capability.