-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlang_35.diff
50 lines (50 loc) · 2.89 KB
/
lang_35.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index ac22f8fd..c499f840 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -3286,6 +3286,22 @@ public class ArrayUtils {
* @throws IllegalArgumentException if both arguments are null
*/
public static <T> T[] add(T[] array, T element) {
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ try { // defects4j.instrumentation
+ return add_original(array, element); // defects4j.instrumentation
+ } catch (ClassCastException e) { // defects4j.instrumentation
+ if (array == null && element == null) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ throw e; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return add_original(array, element); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public static <T> T[] add_original(T[] array, T element) { // defects4j.instrumentation
Class<?> type;
if (array != null){
type = array.getClass();
@@ -3565,6 +3581,22 @@ public class ArrayUtils {
* @throws IllegalArgumentException if both array and element are null
*/
public static <T> T[] add(T[] array, int index, T element) {
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ try { // defects4j.instrumentation
+ return add_original(array, index, element); // defects4j.instrumentation
+ } catch (ClassCastException e) { // defects4j.instrumentation
+ if (array == null && element == null) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ throw e; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return add_original(array, index, element); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public static <T> T[] add_original(T[] array, int index, T element) { // defects4j.instrumentation
Class<?> clss = null;
if (array != null) {
clss = array.getClass().getComponentType();