sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-distribution-kryo-serializer] 02/05: SLING-4075 - added some tests, minor static analysis related fixes
Date Wed, 18 Oct 2017 23:24:01 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-kryo-serializer.git

commit b2eb20b9008dba0d36128cb5babb8ee79e33d4c7
Author: Tommaso Teofili <tommaso@apache.org>
AuthorDate: Tue Apr 11 09:04:05 2017 +0000

    SLING-4075 - added some tests, minor static analysis related fixes
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1790941 13f79535-47bb-0310-9956-ffa450edef68
---
 .../distribution/serialization/impl/kryo/KryoContentSerializer.java | 6 +++---
 .../serialization/impl/kryo/KryoContentSerializerTest.java          | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializer.java
b/src/main/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializer.java
index 541b4ec..2b7db1a 100644
--- a/src/main/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializer.java
+++ b/src/main/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializer.java
@@ -91,7 +91,7 @@ public class KryoContentSerializer implements DistributionContentSerializer
{
         kryo.addDefaultSerializer(InputStream.class, new InputStreamSerializer());
         try {
             Input input = new Input(stream);
-            LinkedList<Resource> resources = (LinkedList<Resource>) kryo.readObject(input,
LinkedList.class);
+            @SuppressWarnings("unchecked") LinkedList<Resource> resources = (LinkedList<Resource>)
kryo.readObject(input, LinkedList.class);
             input.close();
             for (Resource resource : resources) {
                 persistResource(resourceResolver, resource);
@@ -158,7 +158,7 @@ public class KryoContentSerializer implements DistributionContentSerializer
{
             output.writeString(resource.getPath());
             output.writeString(resource.getResourceType());
 
-            HashMap map = new HashMap<String, Object>();
+            HashMap<String, Object> map = new HashMap<String, Object>();
             for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
                 if (propertyFilter == null || propertyFilter.matches(entry.getKey())) {
                     map.put(entry.getKey(), entry.getValue());
@@ -174,7 +174,7 @@ public class KryoContentSerializer implements DistributionContentSerializer
{
             String path = input.readString();
             String resourceType = input.readString();
 
-            final HashMap<String, Object> map = kryo.readObjectOrNull(input, HashMap.class);
+            @SuppressWarnings("unchecked") final HashMap<String, Object> map = kryo.readObjectOrNull(input,
HashMap.class);
 
             return new SyntheticResource(null, path, resourceType) {
                 @Override
diff --git a/src/test/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializerTest.java
b/src/test/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializerTest.java
index df3aa04..9712ef3 100644
--- a/src/test/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializerTest.java
+++ b/src/test/java/org/apache/sling/distribution/serialization/impl/kryo/KryoContentSerializerTest.java
@@ -48,13 +48,12 @@ import static org.junit.Assert.assertTrue;
  */
 public class KryoContentSerializerTest {
 
-    private MockHelper helper;
     private ResourceResolver resourceResolver;
 
     @Before
     public void setUp() throws Exception {
         resourceResolver = new MockResourceResolverFactory().getResourceResolver(null);
-        helper = MockHelper.create(resourceResolver).resource("/libs").p("prop", "value")
+        MockHelper helper = MockHelper.create(resourceResolver).resource("/libs").p("prop",
"value")
                 .resource("sub").p("sub", "hello")
                 .resource(".sameLevel")
                 .resource("/apps").p("foo", "baa");

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message