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
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 @@
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 @@
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 @@
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 @@
*/
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");