Skip to content

Commit bbcdd15

Browse files
leerhojmalkin
authored andcommitted
Fixing issues raised in PR review.
1 parent c91c2a6 commit bbcdd15

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/main/java/org/apache/datasketches/quantiles/DoublesSketchAccessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ abstract class DoublesSketchAccessor extends DoublesBufferAccessor {
4545
final boolean forceSize,
4646
final int level) {
4747
this(checkLvl(level), ds, forceSize, level);
48+
//SpotBugs CT_CONSTRUCTOR_THROW is false positive.
49+
//this construction scheme is compliant with SEI CERT Oracle Coding Standard for Java / OBJ11-J
4850
}
4951

5052
private DoublesSketchAccessor(
51-
final boolean secure,
53+
final boolean secure, //required part of Finalizer Attack prevention
5254
final DoublesSketch ds,
5355
final boolean forceSize,
5456
final int level) {

src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static org.apache.datasketches.quantiles.PreambleUtil.extractN;
3737
import static org.apache.datasketches.quantiles.PreambleUtil.extractPreLongs;
3838
import static org.apache.datasketches.quantiles.PreambleUtil.extractSerVer;
39-
//import static org.apache.datasketches.quantilescommon.QuantilesAPI.EMPTY_MSG;
4039

4140
import java.lang.reflect.Array;
4241
import java.util.Arrays;

src/main/java/org/apache/datasketches/theta/DirectQuickSelectSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private DirectQuickSelectSketch(
121121
}
122122

123123
private DirectQuickSelectSketch(
124-
final boolean secure,
124+
final boolean secure, //required part of Finalizer Attack prevention
125125
final int lgNomLongs,
126126
final long seed,
127127
final float p,

src/main/java/org/apache/datasketches/tuple/arrayofdoubles/DirectArrayOfDoublesQuickSelectSketch.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ class DirectArrayOfDoublesQuickSelectSketch extends ArrayOfDoublesQuickSelectSke
6868
final int numValues,
6969
final long seed,
7070
final WritableMemory dstMem) {
71-
this(validate1(nomEntries, lgResizeFactor, numValues, dstMem),
71+
this(checkMemory(nomEntries, lgResizeFactor, numValues, dstMem),
72+
//SpotBugs CT_CONSTRUCTOR_THROW is false positive.
73+
//this construction scheme is compliant with SEI CERT Oracle Coding Standard for Java / OBJ11-J
7274
nomEntries,
7375
lgResizeFactor,
7476
samplingProbability,
@@ -78,7 +80,7 @@ class DirectArrayOfDoublesQuickSelectSketch extends ArrayOfDoublesQuickSelectSke
7880
}
7981

8082
private DirectArrayOfDoublesQuickSelectSketch(
81-
final boolean secure,
83+
final boolean secure, //required part of Finalizer Attack prevention
8284
final int nomEntries,
8385
final int lgResizeFactor,
8486
final float samplingProbability,
@@ -115,7 +117,7 @@ private DirectArrayOfDoublesQuickSelectSketch(
115117
setRebuildThreshold();
116118
}
117119

118-
private static final boolean validate1(
120+
private static final boolean checkMemory(
119121
final int nomEntries,
120122
final int lgResizeFactor,
121123
final int numValues,
@@ -133,13 +135,13 @@ private static final boolean validate1(
133135
DirectArrayOfDoublesQuickSelectSketch(
134136
final WritableMemory mem,
135137
final long seed) {
136-
this(validate2(mem), mem, seed);
138+
this(checkSerVer_Endianness(mem), mem, seed);
137139
//SpotBugs CT_CONSTRUCTOR_THROW is false positive.
138140
//this construction scheme is compliant with SEI CERT Oracle Coding Standard for Java / OBJ11-J
139141
}
140142

141143
private DirectArrayOfDoublesQuickSelectSketch(
142-
final boolean secure,
144+
final boolean secure, //required part of Finalizer Attack prevention
143145
final WritableMemory mem,
144146
final long seed) {
145147
super(mem.getByte(NUM_VALUES_BYTE), seed);
@@ -159,7 +161,7 @@ private DirectArrayOfDoublesQuickSelectSketch(
159161
setRebuildThreshold();
160162
}
161163

162-
private static final boolean validate2(final Memory mem) {
164+
private static final boolean checkSerVer_Endianness(final Memory mem) {
163165
final byte version = mem.getByte(SERIAL_VERSION_BYTE);
164166
if (version != serialVersionUID) {
165167
throw new SketchesArgumentException("Serial version mismatch. Expected: " + serialVersionUID

0 commit comments

Comments
 (0)