Author: andrew.plotnikov
Date: 2012-02-17 04:32:20 -0500 (Fri, 17 Feb 2012)
New Revision: 5659
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
Log:
EXOJCR-1760: Fixed the Blocker/Critical violations and the easiest Major ones raised by
eXo Quality Level 1.2
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
---
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -82,7 +82,7 @@
/**
* The logger
*/
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.common.http.client.DefaultAuthHandler");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
private static final byte[] NUL = new byte[0];
@@ -98,8 +98,6 @@
private static boolean prompterSet = false;
- private static final Log log =
ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
-
/**
* For Digest authentication we need to set the uri, response and opaque
* parameters. For "Basic" and "SOCKS5" nothing is done.
@@ -114,8 +112,8 @@
else if (!info.getScheme().equalsIgnoreCase("Digest"))
throw new AuthSchemeNotImplException(info.getScheme());
- if (log.isDebugEnabled())
- log.debug("Fixing up Authorization for host " + info.getHost() +
":" + info.getPort() + "; scheme: "
+ if (LOG.isDebugEnabled())
+ LOG.debug("Fixing up Authorization for host " + info.getHost() +
":" + info.getPort() + "; scheme: "
+ info.getScheme() + "; realm: " + info.getRealm());
return digest_fixup(info, req, challenge, resp);
@@ -135,8 +133,8 @@
{
AuthorizationInfo cred;
- if (log.isDebugEnabled())
- log.debug("Requesting Authorization for host " + challenge.getHost() +
":" + challenge.getPort()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Requesting Authorization for host " + challenge.getHost() +
":" + challenge.getPort()
+ "; scheme: " + challenge.getScheme() + "; realm: " +
challenge.getRealm());
// we only handle Basic, Digest and SOCKS5 authentication
@@ -201,8 +199,8 @@
// Done
- if (log.isDebugEnabled())
- log.debug("Got Authorization");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Got Authorization");
return cred;
}
@@ -753,15 +751,15 @@
if (resp.hasEntity())
{
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify digest from " +
hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify digest from " +
hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
else
{
- if (log.isDebugEnabled())
- log.debug("Verifying digest from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying digest from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -813,8 +811,8 @@
&& (qop.getValue().equalsIgnoreCase("auth") ||
!resp.hasEntity()
&& qop.getValue().equalsIgnoreCase("auth-int")))
{
- if (log.isDebugEnabled())
- log.debug("Verifying rspauth from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying rspauth from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -822,8 +820,8 @@
{
// else push md5 stream and verify after body
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify rspauth from " +
hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify rspauth from " +
hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
@@ -901,13 +899,13 @@
A1_hash + ":" + nonce + ":" + req.getMethod() +
":" + (dt == -1 ? "" : hdrs[dt].getValue()) + ":"
+ entity_info + ":" + entity_hash;
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Entity-Info: '" + req.getRequestURI() + ":" +
(ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ LOG.debug("Entity-Info: '" + req.getRequestURI() + ":" +
(ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ entity_body.length + ":" + (ce == -1 ? "" :
hdrs[ce].getValue()) + ":"
+ (lm == -1 ? "" : hdrs[lm].getValue()) + ":" + (ex == -1
? "" : hdrs[ex].getValue()) + "'");
- log.debug("Entity-Body: '" + entity_hash + "'");
- log.debug("Entity-Digest: '" + entity_digest +
"'");
+ LOG.debug("Entity-Body: '" + entity_hash + "'");
+ LOG.debug("Entity-Digest: '" + entity_digest +
"'");
}
return MD5.hexDigest(entity_digest);
@@ -1330,7 +1328,7 @@
class SimpleAuthPopup implements AuthorizationPrompter
{
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.commons.SimpleAuthPopup");
private static BasicAuthBox inp = null;
@@ -1562,7 +1560,7 @@
class SimpleAuthPrompt implements AuthorizationPrompter
{
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.commons.SimpleAuthPrompt");
/**
* the method called by DefaultAuthHandler.
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
===================================================================
---
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -73,7 +73,7 @@
/**
* The logger
*/
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.common.http.client.IdempotentSequence");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.commons.IdempotentSequence");
/** these are the history of previous requests */
private int[] m_history;
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
===================================================================
---
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -152,60 +152,99 @@
LinkedList list = new LinkedList();
list.addToHead("One");
list.addToEnd("Last");
+
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("One");
if (!list.getFirst().equals("Last"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("Last");
if (list.getFirst() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("One");
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
list.remove("Last");
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("Two");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Two"))
- throw new Exception("Second element wrong");
+ {
+ throw new IllegalStateException("Second element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("Last");
list.remove("Two");
list.remove("One");
if (list.getFirst() != null)
- throw new Exception("Empty list wrong");
+ {
+ throw new IllegalStateException("Empty list wrong");
+ }
System.err.println("\n*** Tests finished successfuly"); //NOSONAR
}
Modified:
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
---
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -110,7 +110,7 @@
*/
private URI baseUri;
- private static final Log LOG =
ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.rest.core.ContainerRequest");
/**
* Constructs new instance of ContainerRequest.
Modified:
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
---
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -51,7 +51,7 @@
public final class HeaderHelper
{
- private static final Log LOG =
ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.rest.core.HeaderHelper");
/**
* Constructor.
Modified:
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
---
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -51,8 +51,7 @@
{
private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
- private static final Log LOG = ExoLogger
-
.getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.rest.ext.DefaultGroovyResourceLoader");
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new
ConcurrentHashMap<String, Future<URL>>();
Modified:
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
===================================================================
---
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -47,7 +47,7 @@
public class MockHttpServletResponse implements HttpServletResponse
{
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.test.mock.MockHttpServletResponse");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.testframework.MockHttpServletResponse");
/** The writer. */
private PrintWriter writer;
Modified:
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
===================================================================
---
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17
09:05:27 UTC (rev 5658)
+++
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17
09:32:20 UTC (rev 5659)
@@ -47,7 +47,7 @@
public class MockServletContext implements ServletContext
{
- private static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.MockServletContext");
+ private static final Log LOG =
ExoLogger.getLogger("exo.ws.testframework.MockServletContext");
/** The name. */
private String name;