Skip to content

Commit e3ea164

Browse files
committed
clean up rebase
1 parent 560f123 commit e3ea164

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ protected String encodeModel(Map<String, EncodableSection> sections) {
359359
protected Map<String, EncodableSection> decodeModel(String str) {
360360
if (str == null || str.isEmpty() || str.startsWith("DB")) {
361361
Map<String, EncodableSection> sections = new HashMap<>();
362+
362363
if(str != null && !str.isEmpty()) {
363364
List<CharSequence> encodedSections = SlicedCharSequence.split(str, '~');
364365
HeaderV1 header = new HeaderV1(encodedSections.get(0));

iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerEncoder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public static int decode(BitString bitString) throws DecodingException {
5555
}
5656

5757
public static int decode(BitString bitString, int fromIndex, int length) throws DecodingException {
58-
// must end with "11"
5958
int limit = length - 1;
6059
int end = fromIndex + length;
6160
// must not overflow and must end with "11"

iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static IntegerSet decode(BitString bitString) throws DecodingException {
7171
int end = FibonacciIntegerEncoder.decode(bitString, startIndex, index + 2 - startIndex) + offset;
7272
offset = end;
7373
startIndex = index + 2;
74+
7475
value.addRange(start, end + 1);
7576
} else {
7677
int index = FibonacciIntegerEncoder.indexOfEndTag(bitString, startIndex);

iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ protected void decodeSegment(CharSequence encodedString, EncodableBitStringField
8383
// length of 12 to 16 and known child sensitive data consents changed from a length of 2 to 3 in the
8484
// DE, IA, NE, NH, NJ, TN release
8585
if (bitString.length() == 66) {
86-
BitStringBuilder b = new BitStringBuilder();
87-
b.append(bitString.substring(0, 48));
88-
b.append(BitString.empty(8));
89-
b.append(bitString.substring(48, 52));
90-
b.append(BitString.empty(2));
91-
b.append(bitString.substring(52, 62));
92-
bitString = b.build();
86+
BitStringBuilder builder = new BitStringBuilder();
87+
builder.append(bitString.substring(0, 48));
88+
builder.append(BitString.of("00000000"));
89+
builder.append(bitString.substring(48, 52));
90+
builder.append(BitString.of("00"));
91+
builder.append(bitString.substring(52, 62));
92+
bitString = builder.build();
9393
}
9494

9595
bitStringEncoder.decode(bitString, fields);

iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ public void testEncodeDefault() {
7272

7373
}
7474

75+
@Test
76+
public void testDecodingException() {
77+
Assertions.assertThrows(DecodingException.class, () -> {
78+
new GppModel("invalid gpp string").getHeader();
79+
});
80+
}
81+
82+
@Test()
83+
public void testDecodeGarbage() {
84+
Assertions.assertThrows(DecodingException.class, () -> {
85+
new GppModel("z").getUsCtSection();
86+
});
87+
}
88+
7589
@Test
7690
public void testEncodeDefaultAll() {
7791
GppModel gppModel = new GppModel();
@@ -121,6 +135,7 @@ public void testEncodeDefaultAll() {
121135
gppModel.setFieldValue(UsTn.NAME, UsTxField.VERSION, UsTx.VERSION);
122136

123137

138+
124139
Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME));
125140
Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME));
126141
Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME));

0 commit comments

Comments
 (0)