[exo-jcr-commits] exo-jcr SVN: r5511 - in ws/trunk: exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jan 24 08:12:18 EST 2012


Author: andrew.plotnikov
Date: 2012-01-24 08:12:13 -0500 (Tue, 24 Jan 2012)
New Revision: 5511

Modified:
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
   ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
   ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
   ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
   ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
   ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
   ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
   ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
   ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
   ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,7 +32,11 @@
 
 package org.exoplatform.common.http.client;
 
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.net.ProtocolException;
 import java.util.Enumeration;
 import java.util.Hashtable;
@@ -94,6 +98,8 @@
 {
    // class fields
 
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationInfo");
+
    /** Holds the list of lists of authorization info structures */
    private static Hashtable CntxtList = new Hashtable();
 
@@ -1112,9 +1118,42 @@
             // ai.extra_info = extra_info.clone();
             ai.extra_info = extra_info.getClass().getMethod("clone", null).invoke(extra_info, null);
          }
-         catch (Throwable t)
+         catch (IllegalAccessException e)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
          }
+         catch (IllegalArgumentException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
+         catch (SecurityException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
+         catch (InvocationTargetException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
+         catch (NoSuchMethodException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
+
          ai.paths = new String[paths.length];
          System.arraycopy(paths, 0, ai.paths, 0, paths.length);
       }

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -81,7 +81,7 @@
 
    private Response saved_resp;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
 
    // Constructors
 
@@ -127,22 +127,22 @@
          copyFrom((AuthorizationModule)deferred_auth_list.remove(out));
          req.copyFrom(saved_req);
 
-         if (log.isDebugEnabled())
-            log.debug("Handling deferred auth challenge");
+         if (LOG.isDebugEnabled())
+            LOG.debug("Handling deferred auth challenge");
 
          handle_auth_challenge(req, saved_resp);
 
          if (auth_sent != null)
          {
-            if (log.isDebugEnabled())
-               log.debug("Sending request with Authorization '" + auth_sent + "'");
+            if (LOG.isDebugEnabled())
+               LOG.debug("Sending request with Authorization '" + auth_sent + "'");
 
          }
          else
          {
 
-            if (log.isDebugEnabled())
-               log.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
+            if (LOG.isDebugEnabled())
+               LOG.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
          }
          return REQ_RESTART;
       }
@@ -193,8 +193,8 @@
          prxy_sent = guess;
          prxy_from_4xx = false;
 
-         if (log.isDebugEnabled())
-            log.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
+         if (LOG.isDebugEnabled())
+            LOG.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
 
       }
       if (rem_idx >= 0)
@@ -253,8 +253,8 @@
          auth_sent = guess;
          auth_from_4xx = false;
 
-         if (log.isDebugEnabled())
-            log.debug("Preemptively sending Authorization '" + guess + "'");
+         if (LOG.isDebugEnabled())
+            LOG.debug("Preemptively sending Authorization '" + guess + "'");
 
       }
       if (rem_idx >= 0)
@@ -288,7 +288,11 @@
                AuthorizationInfo.getAuthorization(auth_sent, req, resp, false).addPath(req.getRequestURI());
             }
             catch (AuthSchemeNotImplException asnie)
-            { /* shouldn't happen */
+            {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + asnie.getMessage());
+               }
             }
          }
 
@@ -343,8 +347,8 @@
             {
                if (!HTTPConnection.deferStreamed)
                {
-                  if (log.isDebugEnabled())
-                     log.debug("Status " + sts + " not handled - request has an output stream");
+                  if (LOG.isDebugEnabled())
+                     LOG.debug("Status " + sts + " not handled - request has an output stream");
 
                   return RSP_CONTINUE;
                }
@@ -356,16 +360,16 @@
                req.getStream().reset();
                resp.setRetryRequest(true);
 
-               if (log.isDebugEnabled())
-                  log.debug("Handling of status " + sts + " deferred because an output stream was used");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Handling of status " + sts + " deferred because an output stream was used");
 
                return RSP_CONTINUE;
             }
 
             // handle the challenge
 
-            if (log.isDebugEnabled())
-               log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+            if (LOG.isDebugEnabled())
+               LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
 
             handle_auth_challenge(req, resp);
 
@@ -379,17 +383,25 @@
                }
                catch (IOException ioe)
                {
+                  if (LOG.isTraceEnabled())
+                  {
+                     LOG.trace("An exception occurred: " + ioe.getMessage());
+                  }
                }
 
                if (auth_sent != null)
                {
-                  if (log.isDebugEnabled())
-                     log.debug("Resending request with Authorization '" + auth_sent + "'");
+                  if (LOG.isDebugEnabled())
+                  {
+                     LOG.debug("Resending request with Authorization '" + auth_sent + "'");
+                  }
                }
                else
                {
-                  if (log.isDebugEnabled())
-                     log.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+                  if (LOG.isDebugEnabled())
+                  {
+                     LOG.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+                  }
                }
 
                return RSP_REQUEST;
@@ -397,13 +409,17 @@
 
             if (req.getStream() != null)
             {
-               if (log.isDebugEnabled())
-                  log.debug("Status " + sts + " not handled - request has an output stream");
+               if (LOG.isDebugEnabled())
+               {
+                  LOG.debug("Status " + sts + " not handled - request has an output stream");
+               }
             }
             else
             {
-               if (log.isDebugEnabled())
-                  log.debug("No Auth Info found - status " + sts + " not handled");
+               if (LOG.isDebugEnabled())
+               {
+                  LOG.debug("No Auth Info found - status " + sts + " not handled");
+               }
             }
             return RSP_CONTINUE;
 
@@ -516,11 +532,11 @@
       // get the list of challenges the server sent
       AuthorizationInfo[] challenges = AuthorizationInfo.parseAuthString(auth_str, req, resp);
 
-      if (log.isDebugEnabled())
+      if (LOG.isDebugEnabled())
       {
-         log.debug("Parsed " + challenges.length + " challenges:");
+         LOG.debug("Parsed " + challenges.length + " challenges:");
          for (int idx = 0; idx < challenges.length; idx++)
-            log.debug("AuthM: Challenge " + challenges[idx]);
+            LOG.debug("AuthM: Challenge " + challenges[idx]);
       }
 
       if (challenges.length == 0)

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,6 +32,9 @@
 
 package org.exoplatform.common.http.client;
 
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
 import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -47,6 +50,9 @@
  */
 class BufferedInputStream extends FilterInputStream
 {
+
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.BufferedInputStream");
+
    /** our read buffer */
    private byte[] buffer = new byte[2000];
 
@@ -182,17 +188,20 @@
    {
       int avail = end - pos;
       if (avail == 0)
+      {
          return in.available();
+      }
 
       try
       {
          avail += in.available();
       }
       catch (IOException ignored)
-      { /*
-         * ignore this because we have something
-         * available
-         */
+      {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + ignored.getMessage());
+         }
       }
       return avail;
    }

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -99,13 +99,21 @@
    public Cookie(String name, String value, String domain, String path, Date expires, boolean secure)
    {
       if (name == null)
-         throw new NullPointerException("missing name");
+      {
+         throw new IllegalArgumentException("missing name");
+      }
       if (value == null)
-         throw new NullPointerException("missing value");
+      {
+         throw new IllegalArgumentException("missing value");
+      }
       if (domain == null)
-         throw new NullPointerException("missing domain");
+      {
+         throw new IllegalArgumentException("missing domain");
+      }
       if (path == null)
-         throw new NullPointerException("missing path");
+      {
+         throw new IllegalArgumentException("missing path");
+      }
 
       this.name = name;
       this.value = value;
@@ -115,7 +123,9 @@
       this.secure = secure;
 
       if (this.domain.indexOf('.') == -1)
+      {
          this.domain += ".local";
+      }
    }
 
    /**

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -114,7 +114,7 @@
    /** the cookie policy handler */
    private static CookiePolicyHandler cookie_handler = new DefaultCookiePolicyHandler();
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.CookieModule");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.CookieModule");
 
    // read in cookies from disk at startup
 
@@ -148,8 +148,12 @@
          {
             System.runFinalizersOnExit(true);
          }
-         catch (Throwable t)
+         catch (SecurityException t)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + t.getMessage());
+            }
          }
       }
    }
@@ -168,10 +172,14 @@
             ois.close();
          }
       }
-      catch (Throwable t)
+      catch (IOException t)
       {
          cookie_jar = null;
       }
+      catch (ClassNotFoundException e)
+      {
+         cookie_jar = null;
+      }
    }
 
    private static void saveCookies()
@@ -199,8 +207,12 @@
                oos.writeObject(cookie_list);
                oos.close();
             }
-            catch (Throwable t)
+            catch (IOException t)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + t.getMessage());
+               }
             }
          }
       }
@@ -216,6 +228,10 @@
       }
       catch (Exception e)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
 
       if (file == null)
@@ -307,8 +323,8 @@
 
             if (cookie.hasExpired())
             {
-               if (log.isDebugEnabled())
-                  log.debug("Cookie has expired and is being removed: " + cookie);
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Cookie has expired and is being removed: " + cookie);
 
                if (remove_list == null)
                   remove_list = new Vector();
@@ -375,8 +391,8 @@
 
          req.setHeaders(hdrs);
 
-         if (log.isDebugEnabled())
-            log.debug("Sending cookies '" + value + "'");
+         if (LOG.isDebugEnabled())
+            LOG.debug("Sending cookies '" + value + "'");
 
       }
 
@@ -444,11 +460,11 @@
       else
          cookies = Cookie.parse(set_cookie, req);
 
-      if (log.isDebugEnabled())
+      if (LOG.isDebugEnabled())
       {
-         log.debug("Received and parsed " + cookies.length + " cookies:");
+         LOG.debug("Received and parsed " + cookies.length + " cookies:");
          for (int idx = 0; idx < cookies.length; idx++)
-            log.debug("Cookie " + idx + ": " + cookies[idx]);
+            LOG.debug("Cookie " + idx + ": " + cookies[idx]);
       }
 
       Hashtable cookie_list = Util.getList(cookie_cntxt_list, req.getConnection().getContext());
@@ -459,8 +475,8 @@
             Cookie cookie = (Cookie)cookie_list.get(cookies[idx]);
             if (cookie != null && cookies[idx].hasExpired())
             {
-               if (log.isDebugEnabled())
-                  log.debug("Cookie has expired and is " + "being removed: " + cookie);
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Cookie has expired and is " + "being removed: " + cookie);
 
                cookie_list.remove(cookie); // expired, so remove
             }

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -633,6 +633,10 @@
          }
          catch (ParseException pe)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + pe.getMessage());
+            }
          }
 
          StringTokenizer tok = new StringTokenizer(ch_params[ch_domain].getValue());
@@ -943,11 +947,19 @@
          }
          catch (IOException ioe)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + ioe.getMessage());
+            }
          }
          return data;
       }
-      catch (Throwable t)
+      catch (IOException e)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
 
       /*
@@ -975,6 +987,10 @@
       }
       catch (ArrayIndexOutOfBoundsException aioobe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + aioobe.getMessage());
+         }
       }
 
       return data;
@@ -1313,6 +1329,9 @@
 
 class SimpleAuthPopup implements AuthorizationPrompter
 {
+
+   private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+
    private static BasicAuthBox inp = null;
 
    /**
@@ -1499,6 +1518,10 @@
             }
             catch (SecurityException se)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + se.getMessage());
+               }
             }
          }
 
@@ -1538,6 +1561,9 @@
  */
 class SimpleAuthPrompt implements AuthorizationPrompter
 {
+
+   private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+
    /**
     * the method called by DefaultAuthHandler.
     * @return the username/password pair
@@ -1627,6 +1653,10 @@
          }
          catch (Exception e)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
          }
    }
 

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -49,7 +49,7 @@
    /** number of times the request will be retried */
    private int req_timeout_retries;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
 
    // Constructors
 
@@ -92,16 +92,16 @@
 
             if (req_timeout_retries-- == 0 || req.getStream() != null)
             {
-               if (log.isDebugEnabled())
-                  log.debug("Status " + sts + " " + resp.getReasonLine()
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Status " + sts + " " + resp.getReasonLine()
                      + " not handled - maximum number of retries exceeded");
 
                return RSP_CONTINUE;
             }
             else
             {
-               if (log.isDebugEnabled())
-                  log.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
 
                return RSP_REQUEST;
             }
@@ -116,12 +116,16 @@
             }
             catch (IOException ioe)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + ioe.getMessage());
+               }
             }
             if (req.getData() != null)
                throw new ProtocolException("Received status code 411 even" + " though Content-Length was sent");
 
-            if (log.isDebugEnabled())
-               log.debug("Handling " + sts + " " + resp.getReasonLine()
+            if (LOG.isDebugEnabled())
+               LOG.debug("Handling " + sts + " " + resp.getReasonLine()
                   + " - resending request with 'Content-length: 0'");
 
             req.setData(new byte[0]); // will send Content-Length: 0

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -114,7 +114,7 @@
    /** the method used in the request */
    private String method = null;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
 
    // Constructors
 
@@ -137,6 +137,10 @@
       }
       catch (ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
       this.method = orig.getMethod();
    }
@@ -504,7 +508,7 @@
          }
          catch (IOException ioe)
          {
-            log.error(method + " " + OriginalURI.getPathAndQuery());
+            LOG.error(method + " " + OriginalURI.getPathAndQuery());
 
             try
             {
@@ -512,6 +516,10 @@
             }
             catch (Exception e)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + e.getMessage());
+               }
             }
             throw ioe;
          }
@@ -644,7 +652,7 @@
          {
             if (!(e instanceof InterruptedIOException))
             {
-               log.error(method + " " + OriginalURI.getPathAndQuery());
+               LOG.error(method + " " + OriginalURI.getPathAndQuery());
             }
 
             return "Failed to read headers: " + e;
@@ -943,6 +951,10 @@
          }
          catch (IOException ioe)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + ioe.getMessage());
+            }
          }
       }
    }

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -140,6 +140,10 @@
       }
       catch (Exception e)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
 
       try
@@ -148,6 +152,10 @@
       }
       catch (Exception e)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
    }
 

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -65,7 +65,7 @@
    /** used for deferred redirection retries */
    private Request saved_req;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
 
    // Constructors
 
@@ -140,10 +140,14 @@
          }
          catch (ParseException pe)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + pe.getMessage());
+            }
          }
 
-         if (log.isDebugEnabled())
-            log.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
+         if (LOG.isDebugEnabled())
+            LOG.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
 
          if (!con.isCompatibleWith(new_loc))
          {
@@ -203,8 +207,8 @@
              */
             if (req.getMethod().equals("POST") || req.getMethod().equals("PUT"))
             {
-               if (log.isDebugEnabled())
-                  log.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
 
                sts = 303;
             }
@@ -213,15 +217,15 @@
          case 303 : // See Other (use GET)
          case 307 : // Moved Temporarily (we mean it!)
 
-            if (log.isDebugEnabled())
-               log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+            if (LOG.isDebugEnabled())
+               LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
 
             // the spec says automatic redirection may only be done if
             // the second request is a HEAD or GET.
             if (!req.getMethod().equals("GET") && !req.getMethod().equals("HEAD") && sts != 303)
             {
-               if (log.isDebugEnabled())
-                  log.debug("Not redirected because method is neither HEAD nor GET");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Not redirected because method is neither HEAD nor GET");
 
                if (sts == 301 && resp.getHeader("Location") != null)
                   update_perm_redir_list(req, resLocHdr(resp.getHeader("Location"), req));
@@ -235,16 +239,16 @@
 
             if (sts == 305 || sts == 306)
             {
-               if (log.isDebugEnabled())
-                  log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
 
             }
 
             // Don't accept 305 from a proxy
             if (sts == 305 && req.getConnection().getProxyHost() != null)
             {
-               if (log.isDebugEnabled())
-                  log.debug("305 ignored because a proxy is already in use");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("305 ignored because a proxy is already in use");
 
                resp.setEffectiveURI(lastURI);
                return RSP_CONTINUE;
@@ -259,12 +263,12 @@
              */
             if (level >= 15 || resp.getHeader("Location") == null)
             {
-               if (log.isDebugEnabled())
+               if (LOG.isDebugEnabled())
                {
                   if (level >= 15)
-                     log.debug("Not redirected because of too many levels of redirection");
+                     LOG.debug("Not redirected because of too many levels of redirection");
                   else
-                     log.debug("Not redirected because no Location header was present");
+                     LOG.debug("Not redirected because no Location header was present");
                }
 
                resp.setEffectiveURI(lastURI);
@@ -364,8 +368,8 @@
                   {
                      if (!HTTPConnection.deferStreamed)
                      {
-                        if (log.isDebugEnabled())
-                           log.debug("Status " + sts + " not handled - request has an output stream");
+                        if (LOG.isDebugEnabled())
+                           LOG.debug("Status " + sts + " not handled - request has an output stream");
 
                         return RSP_CONTINUE;
                      }
@@ -410,6 +414,10 @@
             }
             catch (IOException ioe)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + ioe.getMessage());
+               }
             }
 
             if (sts != 305 && sts != 306)
@@ -419,16 +427,20 @@
                   lastURI = new URI(loc, nres);
                }
                catch (ParseException pe)
-               { /* ??? */
+               {
+                  if (LOG.isTraceEnabled())
+                  {
+                     LOG.trace("An exception occurred: " + pe.getMessage());
+                  }
                }
 
-               if (log.isDebugEnabled())
-                  log.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
             }
             else
             {
-               if (log.isDebugEnabled())
-                  log.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
             }
 
             if (req.getStream() != null)
@@ -473,6 +485,10 @@
       }
       catch (ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
 
       if (!cur_loc.equals(new_loc))

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -82,19 +82,24 @@
    /** the total number of bytes of entity data read from the demux so far */
    int count = 0;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
 
    static
    {
       try
       {
          dontTimeoutBody = Boolean.getBoolean("HTTPClient.dontTimeoutRespBody");
-         if (log.isDebugEnabled() && dontTimeoutBody)
-            log.debug("Disabling timeouts when " + "reading response body");
-
+         if (LOG.isDebugEnabled() && dontTimeoutBody)
+         {
+            LOG.debug("Disabling timeouts when " + "reading response body");
+         }
       }
       catch (Exception e)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
    }
 
@@ -150,8 +155,8 @@
       else
       {
          if (resph.resp.cd_type != CD_HDRS)
-            if (log.isDebugEnabled())
-               log.debug("Reading stream " + this.hashCode());
+            if (LOG.isDebugEnabled())
+               LOG.debug("Reading stream " + this.hashCode());
 
          int rcvd;
          if (dontTimeoutBody && resph.resp.cd_type != CD_HDRS)
@@ -221,8 +226,8 @@
          if (dont_truncate && (buffer == null || interrupted))
             readAll(resph.resp.timeout);
 
-         if (log.isDebugEnabled())
-            log.debug("User closed stream " + hashCode());
+         if (LOG.isDebugEnabled())
+            LOG.debug("User closed stream " + hashCode());
 
          demux.closeSocketIfAllStreamsClosed();
 
@@ -271,8 +276,8 @@
     */
    void readAll(int timeout) throws IOException
    {
-      if (log.isDebugEnabled())
-         log.debug("Read-all on stream " + this.hashCode());
+      if (LOG.isDebugEnabled())
+         LOG.debug("Read-all on stream " + this.hashCode());
 
       synchronized (resph.resp)
       {

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -143,7 +143,7 @@
    /** should the request be retried by the application? */
    boolean retry = false;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.Response");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Response");
 
    static
    {
@@ -577,7 +577,7 @@
          }
          catch (IOException ioe)
          {
-            log.error("Response:  (" + inp_stream.hashCode() + ")", ioe);
+            LOG.error("Response:  (" + inp_stream.hashCode() + ")", ioe);
 
             try
             {
@@ -585,6 +585,10 @@
             }
             catch (Exception e)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + e.getMessage());
+               }
             }
             throw ioe;
          }
@@ -732,6 +736,10 @@
       }
       catch (ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
       if (te_hdr != null)
       {
@@ -758,6 +766,10 @@
       }
       catch (ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
 
       // now determine content-delimiter
@@ -813,9 +825,9 @@
          inp_stream.close(); // we will not receive any more data
       }
 
-      if (log.isDebugEnabled())
+      if (LOG.isDebugEnabled())
       {
-         log.debug("Response entity delimiter: "
+         LOG.debug("Response entity delimiter: "
             + (cd_type == CD_0 ? "No Entity" : cd_type == CD_CLOSE ? "Close" : cd_type == CD_CONTLEN ? "Content-Length"
                : cd_type == CD_CHUNKED ? "Chunked" : cd_type == CD_MP_BR ? "Multipart" : "???") + " ("
             + inp_stream.hashCode() + ")");
@@ -952,12 +964,12 @@
     */
    private String readResponseHeaders(InputStream inp) throws IOException
    {
-      if (log.isDebugEnabled())
+      if (LOG.isDebugEnabled())
       {
          if (buf_pos == 0)
-            log.debug("Reading Response headers " + inp_stream.hashCode());
+            LOG.debug("Reading Response headers " + inp_stream.hashCode());
          else
-            log.debug("Resuming reading Response headers " + inp_stream.hashCode());
+            LOG.debug("Resuming reading Response headers " + inp_stream.hashCode());
       }
 
       // read 7 bytes to see type of response
@@ -990,7 +1002,7 @@
          }
          catch (EOFException eof)
          {
-            log.error("Response:  (" + inp_stream.hashCode() + ")", eof);
+            LOG.error("Response:  (" + inp_stream.hashCode() + ")", eof);
 
             throw eof;
          }
@@ -1104,8 +1116,8 @@
       String sts_line = null;
       StringTokenizer lines = new StringTokenizer(headers, "\r\n"), elem;
 
-      if (log.isDebugEnabled())
-         log.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\":  ("
+      if (LOG.isDebugEnabled())
+         LOG.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\":  ("
             + inp_stream.hashCode() + ")\n\n" + headers);
 
       // Detect and handle HTTP/0.9 responses
@@ -1198,6 +1210,10 @@
       }
       catch (ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
    }
 
@@ -1218,8 +1234,8 @@
          throw exception;
       }
 
-      if (log.isDebugEnabled())
-         log.debug("Reading Response trailers " + inp_stream.hashCode());
+      if (LOG.isDebugEnabled())
+         LOG.debug("Reading Response trailers " + inp_stream.hashCode());
 
       try
       {
@@ -1231,8 +1247,8 @@
 
          if (trailers_read)
          {
-            if (log.isDebugEnabled())
-               log.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\":  ("
+            if (LOG.isDebugEnabled())
+               LOG.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\":  ("
                   + inp_stream.hashCode() + ")\n\n" + hdrs);
 
             parseHeaderFields(new StringTokenizer(hdrs.toString(), "\r\n"), Trailers);
@@ -1356,6 +1372,10 @@
          }
          catch (IOException ioe)
          {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + ioe.getMessage());
+            }
          }
       }
    }

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -60,6 +60,9 @@
  */
 class SocksClient
 {
+
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocksClient");
+
    /** the host the socks server sits on */
    private String socks_host;
 
@@ -204,6 +207,10 @@
             }
             catch (IOException ee)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + ee.getMessage());
+               }
             }
          }
 

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -82,7 +82,7 @@
    /** the currently set timeout for the socket */
    private int cur_timeout = 0;
 
-   private static final Log log = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
 
    static
    {
@@ -132,8 +132,8 @@
     */
    private void init(Socket sock) throws IOException
    {
-      if (log.isDebugEnabled())
-         log.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
+      if (LOG.isDebugEnabled())
+         LOG.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
 
       this.Sock = sock;
       this.Stream = new BufferedInputStream(sock.getInputStream());
@@ -241,8 +241,8 @@
             throw resph.exception;
          }
 
-         if (resph.resp.cd_type != CD_HDRS && log.isDebugEnabled())
-            log.debug("Reading for stream " + resph.stream.hashCode());
+         if (resph.resp.cd_type != CD_HDRS && LOG.isDebugEnabled())
+            LOG.debug("Reading for stream " + resph.stream.hashCode());
 
          if (Timer != null)
             Timer.hyber();
@@ -253,8 +253,8 @@
 
             if (timeout != cur_timeout)
             {
-               if (log.isDebugEnabled())
-                  log.debug("Setting timeout to " + timeout + " ms");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Setting timeout to " + timeout + " ms");
 
                Sock.setSoTimeout(timeout);
                cur_timeout = timeout;
@@ -453,8 +453,8 @@
    {
       if (Sock == null) // already cleaned up
          return;
-      if (log.isDebugEnabled())
-         log.debug("Closing all streams and socket (" + this.hashCode() + ")");
+      if (LOG.isDebugEnabled())
+         LOG.debug("Closing all streams and socket (" + this.hashCode() + ")");
 
       try
       {
@@ -462,6 +462,10 @@
       }
       catch (IOException ioe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + ioe.getMessage());
+         }
       }
       try
       {
@@ -469,6 +473,10 @@
       }
       catch (IOException ioe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + ioe.getMessage());
+         }
       }
       Sock = null;
 
@@ -546,8 +554,8 @@
          if (resph != (ResponseHandler)RespHandlerList.getFirst())
             return;
 
-         if (log.isDebugEnabled())
-            log.debug("Closing stream " + resph.stream.hashCode());
+         if (LOG.isDebugEnabled())
+            LOG.debug("Closing stream " + resph.stream.hashCode());
 
          resph.eof = true;
          RespHandlerList.remove(resph);
@@ -655,8 +663,8 @@
             {
                MarkedForClose = resph;
 
-               if (log.isDebugEnabled())
-                  log.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
+               if (LOG.isDebugEnabled())
+                  LOG.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
 
                closeSocketIfAllStreamsClosed();
                return;
@@ -674,8 +682,8 @@
          MarkedForClose = lasth; // resp == null, so use last resph
          closeSocketIfAllStreamsClosed();
 
-         if (log.isDebugEnabled())
-            log.debug("Stream " + lasth.stream.hashCode() + " marked for close");
+         if (LOG.isDebugEnabled())
+            LOG.debug("Stream " + lasth.stream.hashCode() + " marked for close");
       }
    }
 
@@ -686,8 +694,8 @@
     */
    void abort()
    {
-      if (log.isDebugEnabled())
-         log.debug("Aborting socket (" + this.hashCode() + ")");
+      if (LOG.isDebugEnabled())
+         LOG.debug("Aborting socket (" + this.hashCode() + ")");
 
       // notify all responses of abort
 
@@ -711,38 +719,48 @@
          {
             try
             {
-               try
+               Sock.setSoLinger(false, 0);
+            }
+            catch (SocketException se)
+            {
+               if (LOG.isTraceEnabled())
                {
-                  Sock.setSoLinger(false, 0);
+                  LOG.trace("An exception occurred: " + se.getMessage());
                }
-               catch (SocketException se)
-               {
-               }
+            }
 
-               try
+            try
+            {
+               if (Stream != null)
                {
                   Stream.close();
                }
-               catch (IOException ioe)
+            }
+            catch (IOException ioe)
+            {
+               if (LOG.isTraceEnabled())
                {
+                  LOG.trace("An exception occurred: " + ioe.getMessage());
                }
-               try
-               {
-                  Sock.close();
-               }
-               catch (IOException ioe)
-               {
-               }
-               Sock = null;
+            }
 
-               if (Timer != null)
+            try
+            {
+               Sock.close();
+            }
+            catch (IOException ioe)
+            {
+               if (LOG.isTraceEnabled())
                {
-                  Timer.kill();
-                  Timer = null;
+                  LOG.trace("An exception occurred: " + ioe.getMessage());
                }
             }
-            catch (NullPointerException npe)
+            Sock = null;
+
+            if (Timer != null)
             {
+               Timer.kill();
+               Timer = null;
             }
 
             Connection.DemuxList.remove(this);
@@ -796,6 +814,9 @@
  */
 class SocketTimeout extends Thread
 {
+
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocketTimeout");
+
    private boolean alive = true;
 
    /**
@@ -806,6 +827,7 @@
     */
    class TimeoutEntry
    {
+
       boolean restart = false, hyber = false, alive = true;
 
       StreamDemultiplexor demux;
@@ -878,6 +900,10 @@
       }
       catch (SecurityException se)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + se.getMessage());
+         }
       } // Oh well...
       setPriority(MAX_PRIORITY);
 

Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,6 +32,9 @@
 
 package org.exoplatform.common.http.client;
 
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
 import java.lang.reflect.Array;
 import java.net.URL;
 import java.text.DateFormat;
@@ -69,6 +72,8 @@
 
    private static final Object http_parse_lock = new Object();
 
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Util");
+
    static
    {
       // rfc-2616 tspecial
@@ -840,6 +845,10 @@
       }
       catch (java.text.ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
       try
       {
@@ -847,6 +856,10 @@
       }
       catch (java.text.ParseException pe)
       {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + pe.getMessage());
+         }
       }
       try
       {

Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
===================================================================
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.ws.frameworks.json.impl;
 
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.exoplatform.ws.frameworks.json.JsonHandler;
 import org.exoplatform.ws.frameworks.json.value.JsonValue;
 import org.exoplatform.ws.frameworks.json.value.impl.ArrayValue;
@@ -35,6 +37,8 @@
 public class JsonDefaultHandler implements JsonHandler
 {
 
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.json.JsonDefaultHandler");
+
    /** The key. */
    private String key;
 
@@ -190,7 +194,10 @@
                   }
                   catch (NumberFormatException e)
                   {
-                     // nothing to do!
+                     if (LOG.isTraceEnabled())
+                     {
+                        LOG.trace("An exception occurred: " + e.getMessage());
+                     }
                   }
                }
                else
@@ -217,7 +224,10 @@
                         }
                         catch (NumberFormatException d)
                         {
-                           // nothing to do!
+                           if (LOG.isTraceEnabled())
+                           {
+                              LOG.trace("An exception occurred: " + d.getMessage());
+                           }
                         }
                      }
                      // nothing to do!
@@ -241,7 +251,10 @@
                   }
                   catch (NumberFormatException d)
                   {
-                     // nothing to do!
+                     if (LOG.isTraceEnabled())
+                     {
+                        LOG.trace("An exception occurred: " + d.getMessage());
+                     }
                   }
                }
             }

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -262,14 +262,20 @@
          Throwable cause = invExc.getCause();
          // if WebApplicationException than it may contain response
          if (WebApplicationException.class == cause.getClass())
+         {
             throw (WebApplicationException)cause;
+         }
 
          throw new InternalException(cause);
       }
-      catch (Throwable thr)
+      catch (WebApplicationException thr)
       {
          throw new InternalException(thr);
       }
+      catch (InternalException thr)
+      {
+         throw new InternalException(thr);
+      }
    }
 
    /**

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.rest.impl;
 
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.exoplatform.services.rest.GenericContainerRequest;
 import org.exoplatform.services.rest.impl.header.AcceptLanguage;
 import org.exoplatform.services.rest.impl.header.AcceptMediaType;
@@ -108,6 +110,8 @@
     */
    private URI baseUri;
 
+   private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+
    /**
     * Constructs new instance of ContainerRequest.
     * 
@@ -568,7 +572,10 @@
       }
       catch (IllegalArgumentException e)
       {
-         // If the specified date is invalid, the header is ignored.
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
 
       return null;
@@ -587,17 +594,23 @@
       String ifModified = getRequestHeaders().getFirst(IF_MODIFIED_SINCE);
 
       if (ifModified == null)
+      {
          return null;
+      }
       try
       {
          long modifiedSince = HeaderHelper.parseDateHeader(ifModified).getTime();
          if (lastModified < modifiedSince)
+         {
             return Response.notModified();
-
+         }
       }
       catch (IllegalArgumentException e)
       {
-         // If the specified date is invalid, the header is ignored.
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
 
       return null;

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -19,6 +19,8 @@
 package org.exoplatform.services.rest.impl;
 
 import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.exoplatform.services.rest.ApplicationContext;
 import org.exoplatform.services.rest.FieldInjector;
 import org.exoplatform.services.rest.impl.method.ParameterHelper;
@@ -27,6 +29,7 @@
 import org.exoplatform.services.rest.resource.ResourceDescriptorVisitor;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
@@ -51,7 +54,7 @@
 public class FieldInjectorImpl implements FieldInjector
 {
    /** Logger. */
-   //private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
+   private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
 
    /** All annotations including JAX-RS annotation. */
    private final Annotation[] annotations;
@@ -152,7 +155,10 @@
       }
       catch (PrivilegedActionException e)
       {
-         // Ignore NoSuchMethodException.
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
       return setter;
    }
@@ -242,11 +248,13 @@
                jfield.set(resource, pr.resolve(this, context));
             }
          }
-         catch (Throwable e)
+         catch (Exception e)
          {
             Class<?> ac = annotation.annotationType();
             if (ac == MatrixParam.class || ac == QueryParam.class || ac == PathParam.class)
+            {
                throw new WebApplicationException(e, Response.status(Response.Status.NOT_FOUND).build());
+            }
             throw new WebApplicationException(e, Response.status(Response.Status.BAD_REQUEST).build());
          }
       }
@@ -276,10 +284,18 @@
                   jfield.set(resource, tmp);
                }
             }
-            catch (Throwable e)
+            catch (IllegalAccessException e)
             {
                throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
             }
+            catch (IllegalArgumentException e)
+            {
+               throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+            }
+            catch (InvocationTargetException e)
+            {
+               throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+            }
          }
       }
    }

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -70,7 +70,9 @@
    public InputHeadersMap(Map<String, List<String>> m)
    {
       if (m == null)
-         throw new NullPointerException();
+      {
+         throw new IllegalArgumentException();
+      }
       this.m = new HashMap<String, List<String>>(m.size());
       for (Map.Entry<String, List<String>> e : m.entrySet())
          this.m.put(e.getKey().toLowerCase(), Collections.unmodifiableList(e.getValue()));

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -807,7 +807,9 @@
                      break;
                   case SINGLETON :
                      if (instance == null)
-                        throw new NullPointerException("ContextResolver instance is null.");
+                     {
+                        throw new IllegalArgumentException("ContextResolver instance is null.");
+                     }
                      factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
                      break;
                   case CONTAINER :
@@ -853,7 +855,9 @@
             break;
          case SINGLETON :
             if (instance == null)
-               throw new NullPointerException("MessageBodyReader instance is null.");
+            {
+               throw new IllegalArgumentException("MessageBodyReader instance is null.");
+            }
             factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
             break;
          case CONTAINER :
@@ -890,7 +894,9 @@
             break;
          case SINGLETON :
             if (instance == null)
-               throw new NullPointerException("MessageBodyWriter instance is null.");
+            {
+               throw new IllegalArgumentException("MessageBodyWriter instance is null.");
+            }
             factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
             break;
          case CONTAINER :
@@ -947,7 +953,9 @@
                      break;
                   case SINGLETON :
                      if (instance == null)
-                        throw new NullPointerException("ExceptionMapper instance is null.");
+                     {
+                        throw new IllegalArgumentException("ExceptionMapper instance is null.");
+                     }
                      factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
                      break;
                   case CONTAINER :
@@ -980,7 +988,9 @@
             break;
          case SINGLETON :
             if (instance == null)
-               throw new NullPointerException("RequestFilter instance is null.");
+            {
+               throw new IllegalArgumentException("RequestFilter instance is null.");
+            }
             factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
             break;
          case CONTAINER :
@@ -1010,7 +1020,9 @@
             break;
          case SINGLETON :
             if (instance == null)
-               throw new NullPointerException("ResponseFilter instance is null.");
+            {
+               throw new IllegalArgumentException("ResponseFilter instance is null.");
+            }
             factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
             break;
          case CONTAINER :
@@ -1040,7 +1052,9 @@
             break;
          case SINGLETON :
             if (instance == null)
-               throw new NullPointerException("MethodInvokerFilter instance is null.");
+            {
+               throw new IllegalArgumentException("MethodInvokerFilter instance is null.");
+            }
             factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
             break;
          case CONTAINER :

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -19,6 +19,8 @@
 package org.exoplatform.services.rest.impl.header;
 
 import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.exoplatform.services.rest.header.QualityValue;
 
 import java.text.ParseException;
@@ -49,6 +51,8 @@
 public final class HeaderHelper
 {
 
+   private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+
    /**
     * Constructor.
     */
@@ -483,7 +487,10 @@
       }
       catch (ParseException e)
       {
-         // ignore all ParseException now
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
       // no one format was found
       throw new IllegalArgumentException("Not found appropriated date format for " + header);

Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -590,6 +590,10 @@
             }
             catch (NoSuchMethodException e)
             {
+               if (LOG.isTraceEnabled())
+               {
+                  LOG.trace("An exception occurred: " + e.getMessage());
+               }
             }
          }
          if (inhMethod == null)
@@ -614,6 +618,10 @@
                }
                catch (NoSuchMethodException exc)
                {
+                  if (LOG.isTraceEnabled())
+                  {
+                     LOG.trace("An exception occurred: " + exc.getMessage());
+                  }
                }
             }
          }

Modified: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -45,7 +45,7 @@
          um = new InputHeadersMap(null);
          fail("NullPointerException should be here");
       }
-      catch (NullPointerException e)
+      catch (IllegalArgumentException e)
       {
       }
       MultivaluedMap<String, String> m = new MultivaluedMapImpl();

Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -22,6 +22,8 @@
 import groovy.lang.GroovyResourceLoader;
 
 import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -49,6 +51,9 @@
 {
    private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
 
+   private static final Log LOG = ExoLogger
+      .getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+
    public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new ConcurrentHashMap<String, Future<URL>>();
    
    private int maxEntries = 512;
@@ -146,7 +151,10 @@
       }
       catch (CancellationException e)
       {
-         // ignore me
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
       }
       catch (ExecutionException e)
       {

Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -33,7 +33,7 @@
    {
       if (name == null)
       {
-         throw new NullPointerException();
+         throw new IllegalArgumentException();
       }
       this.name = name;
    }

Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -242,7 +242,7 @@
       }
       catch (Exception e)
       {
-         LOG.error(e);
+         LOG.error(e.getMessage());
          return Response.serverError();
       }
       finally
@@ -259,20 +259,30 @@
       
       Type formType = MultivaluedMapImpl.class.getGenericInterfaces()[0];
       MediaType contentType = context.getHttpHeaders().getMediaType();
-      if (contentType == null) {
+      if (contentType == null)
+      {
          contentType = MediaType.APPLICATION_FORM_URLENCODED_TYPE;
-      }      
+      }
 
       MultivaluedMap<String, String> form = new MultivaluedMapImpl();      
-      try {
+      try
+      {
          MessageBodyReader reader =
             context.getProviders().getMessageBodyReader(MultivaluedMap.class, formType, null, contentType);
-         if (reader != null) {
-            form = (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType, context
-               .getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
+         if (reader != null)
+         {
+            form =
+               (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType,
+                  context.getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
          }
-      } catch (Exception e) {         
       }
+      catch (Exception e)
+      {
+         if (LOG.isTraceEnabled())
+         {
+            LOG.trace("An exception occurred: " + e.getMessage());
+         }
+      }
       
       parameters.putAll(form);
       return parameters;

Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -38,7 +38,7 @@
    {
       if (method == null)
       {
-         throw new NullPointerException();
+         throw new IllegalArgumentException();
       }
 
       //

Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java	2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java	2012-01-24 13:12:13 UTC (rev 5511)
@@ -110,7 +110,7 @@
          else
          {
             String msg = "XSLT scheme name is null.";
-            throw new NullPointerException(msg);
+            throw new IllegalArgumentException(msg);
          }
          transformer.initResult(new StreamResult(outStream));
          if (xsltParams != null)



More information about the exo-jcr-commits mailing list