Skip to content

Commit 663b69e

Browse files
committed
Revert "Fix some SpotBugs issues."
This reverts commit 98fd833.
1 parent 98fd833 commit 663b69e

9 files changed

Lines changed: 16 additions & 33 deletions

File tree

src/main/java/org/apache/datasketches/common/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ public static int numDigits(int n) {
767767
* @return the given number to a string prepended with spaces
768768
*/
769769
public static String intToFixedLengthString(final int number, final int length) {
770-
final String num = Integer.toString(number);
770+
final String num = Integer.valueOf(number).toString();
771771
return characterPad(num, length, ' ', false);
772772
}
773773

src/main/java/org/apache/datasketches/kll/KllItemsSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public double[] getRanks(final T[] quantiles, final QuantileSearchCriteria searc
243243
public KllItemsSketchSortedView<T> getSortedView() {
244244
if (isEmpty()) { throw new SketchesArgumentException(EMPTY_MSG); }
245245
refreshSortedView();
246-
return new KllItemsSketchSortedView<T>(kllItemsSV);
246+
return kllItemsSV;
247247
}
248248

249249
@Override

src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,13 @@ public KllItemsSketchSortedView(
6666
final long totalN,
6767
final T minItem,
6868
final Comparator<? super T> comparator) {
69-
this.quantiles = quantiles.clone();
70-
this.cumWeights = cumWeights.clone();
69+
this.quantiles = quantiles;
70+
this.cumWeights = cumWeights;
7171
this.totalN = totalN;
7272
this.minItem = minItem;
7373
this.comp = comparator;
7474
}
7575

76-
/**
77-
* Copy constructor.
78-
* @param sv the given Sorted View
79-
*/
80-
public KllItemsSketchSortedView(final KllItemsSketchSortedView<T> sv) {
81-
this.quantiles = sv.quantiles.clone();
82-
this.cumWeights = sv.cumWeights.clone();
83-
this.totalN = sv.totalN;
84-
this.minItem = sv.minItem;
85-
this.comp = sv.comp;
86-
}
87-
8876
/**
8977
* Constructs this Sorted View given the sketch
9078
* @param sk the given KllItemsSketch.

src/main/java/org/apache/datasketches/quantilescommon/GenericSortedViewIterator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public class GenericSortedViewIterator<T> implements SortedViewIterator {
3535
private int index;
3636

3737
public GenericSortedViewIterator(final T[] quantiles, final long[] cumWeights) {
38-
this.quantiles = quantiles.clone();
39-
this.cumWeights = cumWeights.clone();
38+
this.quantiles = quantiles;
39+
this.cumWeights = cumWeights;
4040
this.totalN = (cumWeights.length > 0) ? cumWeights[cumWeights.length - 1] : 0;
4141
index = -1;
4242
}

src/test/java/org/apache/datasketches/common/TestUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public final class TestUtil {
3131

32-
private static final String userDir = System.getProperty("user.dir");
32+
private static String userDir = System.getProperty("user.dir");
3333

3434
/**
3535
* TestNG group constants
@@ -41,17 +41,17 @@ public final class TestUtil {
4141
/**
4242
* The full target Path for Java serialized sketches to be tested by other languages.
4343
*/
44-
public static final Path javaPath = createPath("target/java_generated_files");
44+
public static Path javaPath = createPath("target/java_generated_files");
4545

4646
/**
4747
* The full target Path for C++ serialized sketches to be tested by Java.
4848
*/
49-
public static final Path cppPath = createPath("target/cpp_generated_files");
49+
public static Path cppPath = createPath("target/cpp_generated_files");
5050

5151
/**
5252
* The full target Path for historical C++ serialized sketches to be tested by Java.
5353
*/
54-
public static final Path cppHistPath = createPath("src/test/resources");
54+
public static Path cppHistPath = createPath("src/test/resources");
5555

5656
private static Path createPath(final String projectLocalDir) {
5757
try {

src/test/java/org/apache/datasketches/kll/KllCrossLanguageTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ public void kllDouble() throws IOException {
154154

155155
@Test(groups = {CHECK_CPP_FILES})
156156
public void kllString() throws IOException {
157-
// the sketch under test intentionally contains numbers in strings to make meaningful assertions
157+
// sketch contains numbers in strings to make meaningful assertions
158158
Comparator<String> numericOrder = new Comparator<String>() {
159159
@Override
160160
public int compare(final String s1, final String s2) {
161161
try {
162162
final int i1 = Integer.parseInt(s1);
163163
final int i2 = Integer.parseInt(s2);
164-
return Integer.compare(i1, i2);
164+
return Integer.valueOf(i1).compareTo(i2);
165165
} catch (NumberFormatException e) {
166166
throw new RuntimeException(e);
167167
}

src/test/java/org/apache/datasketches/quantiles/QuantilesSketchCrossLanguageTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public int compare(final String s1, final String s2) {
6868
try {
6969
final int i1 = Integer.parseInt(s1);
7070
final int i2 = Integer.parseInt(s2);
71-
return Integer.compare(i1, i2);
71+
return Integer.valueOf(i1).compareTo(i2);
7272
} catch (NumberFormatException e) {
7373
throw new RuntimeException(e);
7474
}
@@ -117,7 +117,7 @@ public int compare(final String s1, final String s2) {
117117
try {
118118
final int i1 = Integer.parseInt(s1);
119119
final int i2 = Integer.parseInt(s2);
120-
return Integer.compare(i1, i2);
120+
return Integer.valueOf(i1).compareTo(i2);
121121
} catch (NumberFormatException e) {
122122
throw new RuntimeException(e);
123123
}

src/test/java/org/apache/datasketches/req/ReqSketchCrossLanguageTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import java.io.IOException;
3030
import java.nio.file.Files;
31+
import java.util.Comparator;
3132

3233
import org.apache.datasketches.memory.Memory;
3334
import org.apache.datasketches.quantilescommon.QuantilesFloatsSketchIterator;

tools/FindBugsExcludeFilter.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ under the License.
4040
</Match>
4141

4242
<!-- Harmless, Too many False Positives May 2, 2023 -->
43-
<Match>
43+
<Match>
4444
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
4545
</Match>
46-
47-
<!-- This is test utility class -->
48-
<Match>
49-
<Bug pattern="EI_EXPOSE_REP2" />
50-
<Class name="org.apache.datasketches.req.ReqDebugImpl" />
51-
</Match>
5246

5347
</FindBugsFilter>

0 commit comments

Comments
 (0)