Properly escape the subject

Needed to prevent Revert "test" failing.

Using escapeJava in combination with soy's function escapeUri
this properly turned "test" into \"test\" and then escapeUri turns it back
into "test". This properly escapes as for example

Test+Test does not get converted into Test Test now.

Include a new var escapedSubject to make sure this change is compatible
for users workflow, ie no breaking change.

Bug: Issue 8432
Change-Id: Iecd34d826d5ee471dbd247078ab9a99d062cd091
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
index 2032f74..f13044e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -24,6 +24,7 @@
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
 import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.util.Set;
+import org.apache.commons.lang.StringEscapeUtils;
 
 /** Extractor to translate the various {@code *Attribute}s to {@link Property Properties}. */
 public class PropertyAttributeExtractor {
@@ -58,6 +59,7 @@
     properties.add(propertyFactory.create("branch", changeAttribute.branch));
     properties.add(propertyFactory.create("topic", changeAttribute.topic));
     properties.add(propertyFactory.create("subject", changeAttribute.subject));
+    properties.add(propertyFactory.create("escapedSubject", StringEscapeUtils.escapeJava(changeAttribute.subject)));
 
     // deprecated, to be removed soon. migrate to ones without dash.
     properties.add(propertyFactory.create("commit-message", changeAttribute.commitMessage));
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
index 9ce8e5f..beb0d67 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -120,6 +120,9 @@
     Property propertySubject = createMock(Property.class);
     expect(propertyFactory.create("subject", "testSubject")).andReturn(propertySubject);
 
+    Property propertyEscapedSubject = createMock(Property.class);
+    expect(propertyFactory.create("escapedSubject", "testSubject")).andReturn(propertyEscapedSubject);
+
     Property propertyId2 = createMock(Property.class);
     expect(propertyFactory.create("change-id", "testId")).andReturn(propertyId2);
 
@@ -187,6 +190,7 @@
     expected.add(propertyBranch);
     expected.add(propertyTopic);
     expected.add(propertySubject);
+    expected.add(propertyEscapedSubject);
     expected.add(propertyId);
     expected.add(propertyId2);
     expected.add(propertyNumber);
@@ -236,6 +240,9 @@
     Property propertySubject = createMock(Property.class);
     expect(propertyFactory.create("subject", "testSubject")).andReturn(propertySubject);
 
+    Property propertyEscapedSubject = createMock(Property.class);
+    expect(propertyFactory.create("escapedSubject", "testSubject")).andReturn(propertyEscapedSubject);
+
     Property propertyId = createMock(Property.class);
     expect(propertyFactory.create("changeId", "testId")).andReturn(propertyId);
 
@@ -303,6 +310,7 @@
     expected.add(propertyBranch);
     expected.add(propertyTopic);
     expected.add(propertySubject);
+    expected.add(propertyEscapedSubject);
     expected.add(propertyId);
     expected.add(propertyNumber);
     expected.add(propertyUrl);