abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1220346 - in /abdera/abdera2: client/src/main/java/org/apache/abdera2/protocol/client/ ext/src/main/java/org/apache/abdera2/ext/json/ ext/src/main/java/org/apache/abdera2/ext/license/ ext/src/main/java/org/apache/abdera2/ext/rss/ server/sr...
Date Sun, 18 Dec 2011 08:04:36 GMT
Author: jmsnell
Date: Sun Dec 18 08:04:36 2011
New Revision: 1220346

URL: http://svn.apache.org/viewvc?rev=1220346&view=rev
Log:
findbugs fixes

Modified:
    abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Client.java
    abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/RequestHelper.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONFilter.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONUtil.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/license/LicenseHelper.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssGuid.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssItem.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssSkipDays.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java

Modified: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Client.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Client.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Client.java (original)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Client.java Sun
Dec 18 08:04:36 2011
@@ -35,6 +35,11 @@ public interface Client {
   public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 100;
   public static final int DEFAULT_MAX_REDIRECTS = 10;
   public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 2;
+  
+  // note... findbugs rightfully flags this as a possible bug 
+  // because it's a superclass referencing a static method on 
+  // a subclass, but because of the way the codes written, things
+  // work out.
   public static final String DEFAULT_USER_AGENT = BasicClient.getDefaultUserAgent();
 
   <T extends Client>T addRequestInterceptor(HttpRequestInterceptor i,

Modified: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/RequestHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/RequestHelper.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/RequestHelper.java
(original)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/RequestHelper.java
Sun Dec 18 08:04:36 2011
@@ -90,8 +90,8 @@ public final class RequestHelper {
           httpMethod = new HttpOptions(uri);
         else if (m == TRACE)
           httpMethod = new HttpTrace(uri);
-        else if (m == PATCH)
-          httpMethod = new ExtensionRequest(m.name(),uri,entity);
+//        else if (m == PATCH)
+//          httpMethod = new ExtensionRequest(m.name(),uri,entity);
         else
           httpMethod = new ExtensionRequest(m.name(),uri,entity);
         if (actual != null) {

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONFilter.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONFilter.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONFilter.java Sun Dec 18
08:04:36 2011
@@ -52,7 +52,7 @@ public class JSONFilter implements Task<
         return ProviderHelper.isPreferred(request, "application/json", type);
     }
 
-    private class JsonResponseContext extends ResponseContextWrapper {
+    private static class JsonResponseContext extends ResponseContextWrapper {
 
         private final Abdera abdera;
 

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONUtil.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONUtil.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONUtil.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/json/JSONUtil.java Sun Dec 18
08:04:36 2011
@@ -53,6 +53,8 @@ import org.apache.abdera2.model.TextValu
 import org.apache.abdera2.model.Workspace;
 import org.apache.abdera2.xpath.XPath;
 
+import com.google.common.collect.Iterables;
+
 public class JSONUtil {
 
     public static void toJson(Base base, Writer writer) throws IOException {
@@ -524,9 +526,7 @@ public class JSONUtil {
     }
 
     private static boolean is_empty(Iterable<?> list) {
-      for (@SuppressWarnings("unused") Object obj : list)
-        return false;
-      return true;
+      return Iterables.isEmpty(list);
     }
     
     private static boolean writeList(String name, Iterable<?> list, JSONStream jstream)
throws IOException {

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/license/LicenseHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/license/LicenseHelper.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/license/LicenseHelper.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/license/LicenseHelper.java Sun
Dec 18 08:04:36 2011
@@ -26,6 +26,7 @@ import org.apache.abdera2.model.Link;
 import org.apache.abdera2.model.Source;
 
 import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
 
 /**
  * Implementation of the Atom License Extension, RFC 4946
@@ -59,12 +60,9 @@ public final class LicenseHelper {
         return links == null ? Collections.EMPTY_SET : links;
     }
 
-    @SuppressWarnings("unused")
     private static boolean contains(Iterable<Link> list) {
       if (list == null) return false;
-      for (Link link : list)
-        return true;
-      return false;
+      return !Iterables.isEmpty(list);
     }
     
     public static Iterable<Link> getLicense(Base base) {
@@ -144,9 +142,7 @@ public final class LicenseHelper {
 
     public static boolean hasLicense(Base base, boolean inherited) {
         Iterable<Link> links = getLicense(base, inherited);
-        for (@SuppressWarnings("unused") Link link : links)
-          return true; // if there's one... we're good
-        return false;
+        return !Iterables.isEmpty(links);
     }
 
     public static boolean hasLicense(Base base) {

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssGuid.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssGuid.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssGuid.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssGuid.java Sun Dec 18 08:04:36
2011
@@ -60,7 +60,8 @@ public class RssGuid extends ExtensibleE
     public boolean isPermalink() {
         String v = getAttributeValue("isPermaLink");
         if (v == null)
-            getAttributeValue("ispermalink");
+          v = getAttributeValue("ispermalink");
+        if (v == null) return false;
         return (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("yes"));
     }
 

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssItem.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssItem.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssItem.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssItem.java Sun Dec 18 08:04:36
2011
@@ -655,12 +655,9 @@ public class RssItem extends ExtensibleE
       return person;
     }
     
-    @SuppressWarnings("unused")
     private boolean is_empty(List<?> list) {
       if (list == null) return true;
-      for (Object o : list)
-        return false;
-      return true;
+      return list.isEmpty();
     }
     
     public List<Person> getAuthorsInherited() {

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssSkipDays.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssSkipDays.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssSkipDays.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/rss/RssSkipDays.java Sun Dec 18
08:04:36 2011
@@ -44,7 +44,7 @@ public class RssSkipDays extends Extensi
         for (Element d : days) {
             try {
                 Day check = Day.valueOf(d.getText().toUpperCase());
-                if (d.equals(check))
+                if (day.equals(check))
                     return true;
             } catch (Exception e) {
             }

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java?rev=1220346&r1=1220345&r2=1220346&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
Sun Dec 18 08:04:36 2011
@@ -268,7 +268,7 @@ public abstract class AbstractMultipartC
         return false;
     }
 
-    protected class MultipartRelatedPost {
+    protected static class MultipartRelatedPost {
         private final Document<Entry> entry;
         private final InputStream data;
         private final Map<String, String> entryHeaders;



Mime
View raw message