You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/06/15 22:23:22 UTC

svn commit: r1136174 - /incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java

Author: andy
Date: Wed Jun 15 20:23:22 2011
New Revision: 1136174

URL: http://svn.apache.org/viewvc?rev=1136174&view=rev
Log:
Add use of errorStream on 400s and 500s

Modified:
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java?rev=1136174&r1=1136173&r2=1136174&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java Wed Jun 15 20:23:22 2011
@@ -296,8 +296,20 @@ public class HttpQuery extends Params
             // Other 400 and 500 - errors 
             
             if ( responseCode >= 400 )
-                throw new QueryExceptionHTTP(responseCode, responseMessage) ;
-  
+            {
+                
+                InputStream x = httpConnection.getErrorStream() ;
+                if ( x != null )
+                {
+                    //String ct = httpConnection.getContentType() ;
+                    //httpConnection.getContentEncoding() ;
+                    String str = FileUtils.readWholeFileAsUTF8(x) ;
+                    throw new QueryExceptionHTTP(responseCode, responseMessage+"\n"+str) ;
+                }
+                else
+                    throw new QueryExceptionHTTP(responseCode, responseMessage) ;
+            }
+            
             // Request suceeded
             //httpConnection.setReadTimeout(10) ;
             InputStream in = httpConnection.getInputStream() ;