Skip to content

Commit

Permalink
Security upgrade org.reflections:reflections from 0.9.11 to 0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiguim committed Feb 22, 2024
1 parent ffd19c7 commit 65a3617
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
6 changes: 6 additions & 0 deletions dbptk-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<artifactId>jaxb-impl</artifactId>
<version>2.3.7</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public ArrayCell(String id) {
super(id);
}

private static <T> void toArraySetValue(Object array, T value, Integer... indexes) {
if (indexes.length == 1) {
((T[]) array)[indexes[0] - 1] = value;
} else {
toArraySetValue(Array.get(array, indexes[0] - 1), value, Arrays.copyOfRange(indexes, 1, indexes.length));
}
}

public void put(Cell value, Collection<Integer> position) {
// ensure all arraylists are similar so they can be compared
ComparableIntegerList standardPosition = new ComparableIntegerList();
Expand All @@ -59,7 +67,7 @@ public void put(Cell value, Integer... position) {
*
* Example: for [[A][B,C]] this iterator would return: (1,1:A), then (2,1:B) and
* finally (2,2:C).
*
*
* @return ordered list of cells in a n-dimensional array, paired with their
* position in the array.
*/
Expand All @@ -74,34 +82,6 @@ public Pair<List<Integer>, Cell> apply(Map.Entry<ComparableIntegerList, Cell> in
});
}

private static class ComparableIntegerList extends ArrayList<Integer> implements Comparable<ComparableIntegerList> {
public ComparableIntegerList() {
super();
}

/**
* The first different number between the lists (checked in order) defines the
* result of the comparison (null is considered less than any number). In a
* draw, the smaller list is "less than" the other.
*/
@Override
public int compareTo(ComparableIntegerList other) {
int minSize = this.size() < other.size() ? this.size() : other.size();
for (int i = 0; i < minSize; i++) {
if (this.get(i) != other.get(i)) {
if (this.get(i) == null) {
return -1;
}
if (other.get(i) == null) {
return 1;
}
return this.get(i).compareTo(other.get(i));
}
}
return Integer.compare(this.size(), other.size());
}
}

public boolean isEmpty() {
return arrayData.isEmpty();
}
Expand Down Expand Up @@ -140,14 +120,6 @@ public int calculateDimensions() {
}
}

private static <T> void toArraySetValue(Object array, T value, Integer... indexes) {
if (indexes.length == 1) {
((T[]) array)[indexes[0] - 1] = value;
} else {
toArraySetValue(Array.get(array, indexes[0] - 1), value, Arrays.copyOfRange(indexes, 1, indexes.length));
}
}

public <T> Object[] toArray(Function<Cell, T> cellToObject, Class<T> objectClass) throws InvalidDataException {
if (arrayData.isEmpty()) {
return new Object[] {};
Expand Down Expand Up @@ -184,4 +156,32 @@ public <T> Object[] toArray(Function<Cell, T> cellToObject, Class<T> objectClass

return (Object[]) multidimensionalArray;
}

private static class ComparableIntegerList extends ArrayList<Integer> implements Comparable<ComparableIntegerList> {
public ComparableIntegerList() {
super();
}

/**
* The first different number between the lists (checked in order) defines the
* result of the comparison (null is considered less than any number). In a
* draw, the smaller list is "less than" the other.
*/
@Override
public int compareTo(ComparableIntegerList other) {
int minSize = this.size() < other.size() ? this.size() : other.size();
for (int i = 0; i < minSize; i++) {
if (this.get(i) != other.get(i)) {
if (this.get(i) == null) {
return -1;
}
if (other.get(i) == null) {
return 1;
}
return this.get(i).compareTo(other.get(i));
}
}
return Integer.compare(this.size(), other.size());
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
<version>0.10.2</version>
</dependency>

<!-- common -->
Expand Down

0 comments on commit 65a3617

Please sign in to comment.