-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlang_46.diff
34 lines (34 loc) · 2.3 KB
/
lang_46.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/src/java/org/apache/commons/lang/StringEscapeUtils.java b/src/java/org/apache/commons/lang/StringEscapeUtils.java
index 7b22e214..79715f7e 100644
--- a/src/java/org/apache/commons/lang/StringEscapeUtils.java
+++ b/src/java/org/apache/commons/lang/StringEscapeUtils.java
@@ -83,6 +83,30 @@ public class StringEscapeUtils {
* @return String with escaped values, <code>null</code> if null string input
*/
public static String escapeJava(String str) {
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ String returnValue = escapeJava_original(str); // defects4j.instrumentation
+ if (str != null && str.contains("/")) { // defects4j.instrumentation
+ int idx_input = str.indexOf("/"); // defects4j.instrumentation
+ int idx_result = returnValue.indexOf("/"); // defects4j.instrumentation
+ while (idx_input != -1) { // defects4j.instrumentation
+ if (idx_input == 0 && idx_result != 0) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ if (str.charAt(idx_input - 1) != '\\' && returnValue.charAt(idx_result - 1) == '\\') { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ idx_input = str.indexOf("/", idx_input + 1); // defects4j.instrumentation
+ idx_result = returnValue.indexOf("/", idx_result + 1); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return escapeJava_original(str); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public static String escapeJava_original(String str) { // defects4j.instrumentation
return escapeJavaStyleString(str, false);
}