Commits

Sebastian Sdorra committed bb8db4b

improve logging of client util

Comments (0)

Files changed (1)

scm-clients/scm-client-impl/src/main/java/sonia/scm/client/ClientUtil.java

    * @param response
    */
   public static void appendContent(ScmClientException exception,
-                                   ClientResponse response)
+    ClientResponse response)
   {
     try
     {
    * @param expectedStatusCode
    */
   public static void checkResponse(ClientResponse response,
-                                   int expectedStatusCode)
+    int expectedStatusCode)
   {
     int sc = response.getStatus();
 
     if (sc != expectedStatusCode)
     {
+      if (logger.isWarnEnabled())
+      {
+        logger.warn("response code {} expected, but {} returned",
+          expectedStatusCode, sc);
+      }
+
       sendException(response, sc);
     }
   }
 
     if (sc >= 300)
     {
+      if (logger.isWarnEnabled())
+      {
+        logger.warn("request failed, response code {} returned", sc);
+      }
+      
       sendException(response, sc);
     }
   }
    * @return
    */
   public static WebResource createResource(Client client, String url,
-          boolean enableLogging)
+    boolean enableLogging)
   {
     WebResource resource = client.resource(url);