Repository: shapesecurity/salvation (java)

Issue:
'self' in source list is not resolved during the optimisation
Example: 
policy `object-src example.com *` served by example.com is optimised to empty policy ""

`object-src 'self' *` remains unmodofied

Pull request description:
fixes #81: optimise policy while adding
set current version to 1.0.2

Patch:
diff --git a/pom.xml b/pom.xml
index 67ba48f..aeb2656 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
 
     <groupId>com.shapesecurity</groupId>
     <artifactId>salvation</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.2</version>
     <packaging>jar</packaging>
 
     <name>salvation</name>
diff --git a/src/main/java/com/shapesecurity/salvation/data/Policy.java b/src/main/java/com/shapesecurity/salvation/data/Policy.java
index d960031..c4dc44e 100644
--- a/src/main/java/com/shapesecurity/salvation/data/Policy.java
+++ b/src/main/java/com/shapesecurity/salvation/data/Policy.java
@@ -266,6 +266,7 @@ public class Policy implements Show {
         if (directive == null) {
             this.directives.put(d.getClass(), d);
             this.expandDefaultSrc();
+            this.resolveSelf();
             this.optimise();
         }
     }


Test patch:
diff --git a/src/test/java/com/shapesecurity/salvation/ParserTest.java b/src/test/java/com/shapesecurity/salvation/ParserTest.java
index 9ef67db..cbcc82f 100644
--- a/src/test/java/com/shapesecurity/salvation/ParserTest.java
+++ b/src/test/java/com/shapesecurity/salvation/ParserTest.java
@@ -148,6 +148,11 @@ public class ParserTest extends CSPTest {
         assertEquals("directive-name, host-source a:*", "script-src a:*", parseAndShow("script-src a:*"));
         assertEquals("directive-name, host-source http://a:*", "script-src http://a:*", parseAndShow("script-src http://a:*"));
 
+        // GH-81 should pass
+        assertEquals("optimisation", "", parseAndShow("script-src example.com *"));
+        assertEquals("optimisation", "", parseAndShow("script-src 'self' *"));
+
+
     }
 
     @Test