abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1220535 - in /abdera/abdera2: common/src/main/java/org/apache/abdera2/common/protocol/ common/src/main/java/org/apache/abdera2/common/protocol/servlet/ common/src/main/java/org/apache/abdera2/common/security/ common/src/main/java/org/apach...
Date Sun, 18 Dec 2011 20:51:03 GMT
Author: jmsnell
Date: Sun Dec 18 20:51:02 2011
New Revision: 1220535

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

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/TemplateManagerTargetBuilder.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/ServletRequestContext.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/security/KeyHelper.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
    abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/StaxStreamWriter.java
    abdera/abdera2/core/src/main/java/org/apache/abdera2/util/MorePredicates.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/provider/managed/Configuration.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/MultipartRelatedEntityTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/templates/TemplateTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CodepointIteratorTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/TemplateManagerTargetBuilder.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/TemplateManagerTargetBuilder.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/TemplateManagerTargetBuilder.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/TemplateManagerTargetBuilder.java
Sun Dec 18 20:51:02 2011
@@ -81,7 +81,7 @@ public class TemplateManagerTargetBuilde
         } else {
             context = new ObjectContext(param, true);
         }
-    }
+    } else context = new MapContext();
     return new RequestTemplateContext(request, context);
   }
 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/ServletRequestContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/ServletRequestContext.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/ServletRequestContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/ServletRequestContext.java
Sun Dec 18 20:51:02 2011
@@ -260,7 +260,7 @@ public class ServletRequestContext 
       case AUTHTYPE:
           return request.getAuthType();
       case CONTENTLENGTH:
-          return new Integer(request.getContentLength());
+          return Integer.valueOf(request.getContentLength());
       case CONTENTTYPE:
           return request.getContentType();
       case CONTEXTPATH:

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/security/KeyHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/security/KeyHelper.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/security/KeyHelper.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/security/KeyHelper.java
Sun Dec 18 20:51:02 2011
@@ -51,7 +51,9 @@ public final class KeyHelper {
   
     public static void saveKeystore(KeyStore ks, String file, String password) throws KeyStoreException,
         NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException
{
-        ks.store(new FileOutputStream(file), password.toCharArray());
+        FileOutputStream out = new FileOutputStream(file);
+        ks.store(out, password.toCharArray());
+        out.close();
     }
 
     public static KeyStore loadKeystore(String file, String pass) throws KeyStoreException,
NoSuchAlgorithmException,

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
Sun Dec 18 20:51:02 2011
@@ -26,7 +26,7 @@ public abstract class DelegatingContext 
     protected final Context subcontext;
 
     protected DelegatingContext(Context subcontext) {
-      super(subcontext != null ? subcontext.isIri() : false);
+      super(subcontext.isIri());
       checkNotNull(subcontext);
       this.subcontext = subcontext;
     }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/StaxStreamWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/StaxStreamWriter.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/StaxStreamWriter.java
(original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/StaxStreamWriter.java
Sun Dec 18 20:51:02 2011
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Stack;
 
+import javax.annotation.Nullable;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -165,7 +166,7 @@ public class StaxStreamWriter extends Ab
         return this;
     }
 
-    private void writeNamespace(String prefix, String namespace, boolean attr) throws XMLStreamException
{
+    private void writeNamespace(@Nullable String prefix, String namespace, boolean attr)
throws XMLStreamException {
         prefix = prefix != null ? prefix : "";
         if (!declared(prefix, namespace)) {
             if (attr && (namespace == null || "".equals(namespace)))

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/util/MorePredicates.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/util/MorePredicates.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/util/MorePredicates.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/util/MorePredicates.java Sun Dec
18 20:51:02 2011
@@ -27,7 +27,7 @@ public class MorePredicates {
       }
   };
   
-  private static boolean is_media(Content content) {
+  static boolean is_media(Content content) {
     return content.getSrc() != null || 
            content.getContentType() == Content.Type.MEDIA;
   }
@@ -49,10 +49,11 @@ public class MorePredicates {
           if (entry.getAuthorInherited() == null)
               return false;
           Content content = entry.getContentElement();
-          if (content == null)
-            if (entry.getAlternateLink() == null)
+          if (content == null) {
+            if (entry.getAlternateLink() == null) {
               return false;
-          else
+            }
+          } else
             if (is_media(content) && !entry.has(Constants.SUMMARY))
               return false;
         } catch (Exception e) {

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/provider/managed/Configuration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/provider/managed/Configuration.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/provider/managed/Configuration.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/provider/managed/Configuration.java
Sun Dec 18 20:51:02 2011
@@ -26,7 +26,9 @@ public abstract class Configuration {
 
     static Properties loadFileAsProperties(String fileLocation) throws IOException {
         Properties props = new Properties();
-        props.load(new FileInputStream(fileLocation));
+        FileInputStream in = new FileInputStream(fileLocation);
+        props.load(in);
+        in.close();
         return props;
     }
 

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/MultipartRelatedEntityTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/MultipartRelatedEntityTest.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/MultipartRelatedEntityTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/MultipartRelatedEntityTest.java
Sun Dec 18 20:51:02 2011
@@ -81,26 +81,25 @@ public class MultipartRelatedEntityTest 
 
         byte[] line = new byte[BUFF_SIZE];
         ByteArrayOutputStream output = new ByteArrayOutputStream();
-        while (input.read(line) != -1) {
+        while (input.read(line) != -1)
             output.write(line);
-        }
+        input.close();
 
         Base64 base64 = new Base64();
         byte[] encoded = base64.encode(output.toByteArray());
-        ByteArrayInputStream bi = new ByteArrayInputStream(base64.decode(encoded));
+        ByteArrayInputStream bi = 
+          new ByteArrayInputStream(base64.decode(encoded));
 
         File f = new File("info-out.png");
         if (f.exists())
-            f.delete();
-        f.createNewFile();
-        FileOutputStream fo = new FileOutputStream(f);
-
-        int end;
-        while ((end = bi.read(line)) != -1) {
+          f.delete();
+        if (f.createNewFile()) {
+          FileOutputStream fo = new FileOutputStream(f);
+          int end;
+          while ((end = bi.read(line)) != -1)
             fo.write(line, 0, end);
+          fo.flush();
+          fo.close();
         }
-
-        fo.flush();
-        fo.close();
     }
 }

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/templates/TemplateTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/templates/TemplateTest.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/templates/TemplateTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/templates/TemplateTest.java
Sun Dec 18 20:51:02 2011
@@ -62,7 +62,7 @@ public class TemplateTest {
       return 1;
     }
     public Integer getB() {
-      return new Integer(2);
+      return Integer.valueOf(2);
     }
     public Integer getC() {
       return 3;

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CodepointIteratorTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CodepointIteratorTest.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CodepointIteratorTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CodepointIteratorTest.java
Sun Dec 18 20:51:02 2011
@@ -14,11 +14,11 @@ public class CodepointIteratorTest {
     // test supplemental codepoints...
     char[] chars = {'A','B',0xD800,0xDEB7,'C','D'};
     CodepointIterator ci = CodepointIterator.getInstance(chars);
-    assertEquals(new Integer(65),ci.next());
-    assertEquals(new Integer(66),ci.next());
-    assertEquals(new Integer(66231),ci.next());
-    assertEquals(new Integer(67),ci.next());
-    assertEquals(new Integer(68),ci.next());
+    assertEquals(Integer.valueOf(65),ci.next());
+    assertEquals(Integer.valueOf(66),ci.next());
+    assertEquals(Integer.valueOf(66231),ci.next());
+    assertEquals(Integer.valueOf(67),ci.next());
+    assertEquals(Integer.valueOf(68),ci.next());
     ci.next(); // will throw exception
   }
   

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java?rev=1220535&r1=1220534&r2=1220535&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
Sun Dec 18 20:51:02 2011
@@ -68,7 +68,7 @@ public class CustomProvider extends Abst
         return adapter;
     }
 
-    public class SimpleFilter implements Task<RequestContext,ResponseContext> {
+    public static class SimpleFilter implements Task<RequestContext,ResponseContext>
{
         public ResponseContext apply(RequestContext request, Chain<RequestContext,ResponseContext>
chain) {
             BaseRequestContextWrapper rcw = new BaseRequestContextWrapper(request);
             rcw.setAttribute("offset", 10);



Mime
View raw message