Author: andrew.plotnikov
Date: 2011-12-23 08:21:25 -0500 (Fri, 23 Dec 2011)
New Revision: 5346
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/Cookie2.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/HTTPResponse.java
Log:
EXOJCR-1687: Fixed new sonar violations in project
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 2011-12-23
13:18:15 UTC (rev 5345)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java 2011-12-23
13:21:25 UTC (rev 5346)
@@ -493,11 +493,14 @@
*/
protected boolean sendWith(RoRequest req)
{
- HTTPConnection con = req.getConnection();
+ HTTPConnection con = req.getConnection();
String eff_host = con.getHost();
+
if (eff_host.indexOf('.') == -1)
- eff_host += ".local";
-
+ {
+ eff_host += ".local"; //NOSONAR
+ }
+
return ((domain.charAt(0) == '.' && eff_host.endsWith(domain) ||
domain.charAt(0) != '.'
&& eff_host.equals(domain))
&& Util.getPath(req.getRequestURI()).startsWith(path) &&
(!secure || con.getProtocol().equals("https") || con
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie2.java
===================================================================
---
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie2.java 2011-12-23
13:18:15 UTC (rev 5345)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie2.java 2011-12-23
13:21:25 UTC (rev 5346)
@@ -346,12 +346,14 @@
continue;
}
- // if host name is simple (i.e w/o a domain) then append .local
+ // if host name is simple (i.e w/o a domain) then append .local
String eff_host = req.getConnection().getHost();
if (eff_host.indexOf('.') == -1)
- eff_host += ".local";
+ {
+ eff_host += ".local"; //NOSONAR
+ }
- // domain must be either .local or must contain at least two dots
+ // domain must be either .local or must contain at least two dots
if (!curr.domain.equals(".local") &&
curr.domain.indexOf('.', 1) == -1)
{
log.warn("Bad Set-Cookie2 header: " + set_cookie + ", domain
'" + curr.domain + "' is not '.local' and "
@@ -359,7 +361,7 @@
continue;
}
- // domain must domain match host
+ // domain must domain match host
if (!eff_host.endsWith(curr.domain))
{
log.warn("Bad Set-Cookie2 header: " + set_cookie + ", domain
'" + curr.domain + "' does not match current"
@@ -367,7 +369,7 @@
continue;
}
- // host minus domain may not contain any dots
+ // host minus domain may not contain any dots
if (eff_host.substring(0, eff_host.length() -
curr.domain.length()).indexOf('.') != -1)
{
log.warn("Bad Set-Cookie2 header: " + set_cookie + ", domain
'" + curr.domain + "' is more than one '.'"
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 2011-12-23
13:18:15 UTC (rev 5345)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java 2011-12-23
13:21:25 UTC (rev 5346)
@@ -701,8 +701,11 @@
public boolean acceptCookie(Cookie cookie, RoRequest req, RoResponse resp)
{
String server = req.getConnection().getHost();
+
if (server.indexOf('.') == -1)
- server += ".local";
+ {
+ server += ".local"; //NOSONAR
+ }
// Check lists. Reject takes priority over accept
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 2011-12-23
13:18:15 UTC (rev 5345)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java 2011-12-23
13:21:25 UTC (rev 5346)
@@ -314,12 +314,17 @@
public Date getHeaderAsDate(String hdr) throws IOException, IllegalArgumentException,
ModuleException
{
String raw_date = getHeader(hdr);
+
if (raw_date == null)
+ {
return null;
+ }
// asctime() format is missing an explicit GMT specifier
if (raw_date.toUpperCase().indexOf("GMT") == -1 &&
raw_date.indexOf(' ') > 0)
- raw_date += " GMT";
+ {
+ raw_date += " GMT"; //NOSONAR
+ }
Date date;
@@ -414,7 +419,9 @@
// asctime() format is missing an explicit GMT specifier
if (raw_date.toUpperCase().indexOf("GMT") == -1 &&
raw_date.indexOf(' ') > 0)
- raw_date += " GMT";
+ {
+ raw_date += " GMT"; //NOSONAR
+ }
Date date;
Show replies by date