Skip to content

Commit 3557e5f

Browse files
committed
Merge branch 'feature/pools'
2 parents 607379b + f3907ff commit 3557e5f

File tree

14 files changed

+1039
-91
lines changed

14 files changed

+1039
-91
lines changed

.markdownlint.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# See https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
1+
# See [rules](https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml)
22

33
# Default state for all rules
44
default: true
@@ -27,12 +27,4 @@ MD036: false
2727

2828
# MD043/required-headings : Required heading structure :
2929
# https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md043.md
30-
MD043:
31-
# List of headings
32-
headings: [
33-
"# Head",
34-
"## Item",
35-
"### Detail"
36-
]
37-
# Match case of headings
38-
match_case: false
30+
MD043: false

org.jdrupes.vmoperator.common/src/org/jdrupes/vmoperator/common/K8sDynamicModelsBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public K8sDynamicModelsBase(Class<T> itemClass, Gson delegate,
6262
} catch (InstantiationException | IllegalAccessException
6363
| IllegalArgumentException | InvocationTargetException
6464
| NoSuchMethodException | SecurityException exc) {
65-
throw new IllegalArgumentException(exc);
65+
throw new IllegalArgumentException(exc); // NOPMD
6666
}
6767
}
6868
}

org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/Runner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
*/
193193
@SuppressWarnings({ "PMD.ExcessiveImports", "PMD.AvoidPrintStackTrace",
194194
"PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods",
195-
"PMD.CouplingBetweenObjects" })
195+
"PMD.CouplingBetweenObjects", "PMD.TooManyFields" })
196196
public class Runner extends Component {
197197

198198
private static final String QEMU = "qemu";

org.jdrupes.vmoperator.util/src/org/jdrupes/vmoperator/util/DataPath.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
package org.jdrupes.vmoperator.util;
2020

21+
import java.lang.reflect.Array;
2122
import java.lang.reflect.InvocationTargetException;
2223
import java.lang.reflect.Method;
2324
import java.util.ArrayList;
@@ -157,11 +158,12 @@ public static <T> T deepCopy(T object) {
157158
return (T) copy;
158159
}
159160
if (object.getClass().isArray()) {
160-
var copy = new ArrayList<>();
161-
for (var item : (Object[]) object) {
162-
copy.add(deepCopy(item));
161+
var copy = Array.newInstance(object.getClass().getComponentType(),
162+
Array.getLength(object));
163+
for (int i = 0; i < Array.getLength(object); i++) {
164+
Array.set(copy, i, deepCopy(Array.get(object, i)));
163165
}
164-
return (T) copy.toArray();
166+
return (T) copy;
165167
}
166168
if (object instanceof Cloneable) {
167169
try {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.jdrupes.vmoperator.util;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
import org.junit.jupiter.api.Test;
5+
6+
class DataPathTests {
7+
8+
@Test
9+
void testArray() {
10+
int[] orig
11+
= { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
12+
var copy = DataPath.deepCopy(orig);
13+
for (int i = 0; i < orig.length; i++) {
14+
assertEquals(orig[i], copy[i]);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)