Skip to content

Commit 560f123

Browse files
committed
clean up rebase
1 parent 83e8d5a commit 560f123

File tree

4 files changed

+44
-22
lines changed

4 files changed

+44
-22
lines changed

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ private EncodableSection getOrCreateSection(String sectionName) {
9797
case UsTx.NAME:
9898
section = new UsTx();
9999
break;
100+
case UsDe.NAME:
101+
section = new UsDe();
102+
break;
103+
case UsIa.NAME:
104+
section = new UsIa();
105+
break;
106+
case UsNe.NAME:
107+
section = new UsNe();
108+
break;
109+
case UsNh.NAME:
110+
section = new UsNh();
111+
break;
112+
case UsNj.NAME:
113+
section = new UsNj();
114+
break;
115+
case UsTn.NAME:
116+
section = new UsTn();
117+
break;
100118
}
101119
if (section != null) {
102120
this.sections.put(sectionName, section);
@@ -111,7 +129,6 @@ public void setFieldValue(String sectionName, String fieldName, Object value) {
111129
this.dirty = false;
112130
this.decoded = true;
113131
}
114-
115132
EncodableSection section = getOrCreateSection(sectionName);
116133
if (section != null) {
117134
section.setFieldValue(fieldName, value);
@@ -131,7 +148,6 @@ public Object getFieldValue(String sectionName, String fieldName) {
131148
this.dirty = false;
132149
this.decoded = true;
133150
}
134-
135151
EncodableSection field = this.sections.get(sectionName);
136152
if (field != null) {
137153
return field.getFieldValue(fieldName);
@@ -150,7 +166,6 @@ public boolean hasField(String sectionName, String fieldName) {
150166
this.dirty = false;
151167
this.decoded = true;
152168
}
153-
154169
EncodableSection field = this.sections.get(sectionName);
155170
if (field != null) {
156171
return field.hasField(fieldName);
@@ -199,7 +214,6 @@ public EncodableSection getSection(String sectionName) {
199214
this.dirty = false;
200215
this.decoded = true;
201216
}
202-
203217
return this.sections.get(sectionName);
204218
}
205219

@@ -213,7 +227,6 @@ public void deleteSection(String sectionName) {
213227
this.dirty = false;
214228
this.decoded = true;
215229
}
216-
217230
if (this.sections.remove(sectionName) != null) {
218231
this.dirty = true;
219232
}
@@ -308,7 +321,6 @@ public List<Integer> getSectionIds() {
308321
this.dirty = false;
309322
this.decoded = true;
310323
}
311-
312324
int length = Sections.SECTION_ORDER.size();
313325
List<Integer> sectionIds = new ArrayList<>(length);
314326
for (int i = 0; i < length; i++) {
@@ -396,6 +408,24 @@ protected Map<String, EncodableSection> decodeModel(String str) {
396408
case UsTx.ID:
397409
sections.put(UsTx.NAME, new UsTx(section));
398410
break;
411+
case UsDe.ID:
412+
sections.put(UsDe.NAME, new UsDe(section));
413+
break;
414+
case UsIa.ID:
415+
sections.put(UsIa.NAME, new UsIa(section));
416+
break;
417+
case UsNe.ID:
418+
sections.put(UsNe.NAME, new UsNe(section));
419+
break;
420+
case UsNh.ID:
421+
sections.put(UsNh.NAME, new UsNh(section));
422+
break;
423+
case UsNj.ID:
424+
sections.put(UsNj.NAME, new UsNj(section));
425+
break;
426+
case UsTn.ID:
427+
sections.put(UsTn.NAME, new UsTn(section));
428+
break;
399429
}
400430
}
401431
}
@@ -428,7 +458,6 @@ public String encodeSection(String sectionName) {
428458
this.dirty = false;
429459
this.decoded = true;
430460
}
431-
432461
EncodableSection section = this.sections.get(sectionName);
433462
if (section != null) {
434463
return section.encode();
@@ -449,7 +478,6 @@ public void decodeSection(String sectionName, String encodedString) {
449478
}
450479

451480
EncodableSection section = getOrCreateSection(sectionName);
452-
453481
if (section != null) {
454482
section.decode(encodedString);
455483
this.dirty = true;

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder;
55
import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder;
66
import com.iab.gpp.encoder.bitstring.BitString;
7+
import com.iab.gpp.encoder.bitstring.BitStringBuilder;
78
import com.iab.gpp.encoder.bitstring.BitStringEncoder;
89
import com.iab.gpp.encoder.datatype.EncodableFixedInteger;
910
import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList;
@@ -82,8 +83,13 @@ protected void decodeSegment(CharSequence encodedString, EncodableBitStringField
8283
// length of 12 to 16 and known child sensitive data consents changed from a length of 2 to 3 in the
8384
// DE, IA, NE, NH, NJ, TN release
8485
if (bitString.length() == 66) {
85-
bitString =
86-
bitString.substring(0, 48) + "00000000" + bitString.substring(48, 52) + "00" + bitString.substring(52, 62);
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();
8793
}
8894

8995
bitStringEncoder.decode(bitString, fields);

iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,4 @@ public void testDecode8() {
115115

116116
}
117117
}
118-
119-
@Test
120-
public void testGiantRange() {
121-
String max = FibonacciIntegerEncoder.encode(FibonacciIntegerRangeEncoder.MAX_SIZE + 1);
122-
Assertions.assertEquals(List.of(), FibonacciIntegerRangeEncoder.decode("000000000001111" + max));
123-
}
124118
}

iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,4 @@ public void testDecode10() {
151151

152152
}
153153
}
154-
155-
@Test
156-
public void testGiantRange() {
157-
String max = FibonacciIntegerEncoder.encode(FibonacciIntegerRangeEncoder.MAX_SIZE + 1);
158-
Assertions.assertEquals(List.of(), FixedIntegerRangeEncoder.decode("00000000000110000000000000001" + max));
159-
}
160154
}

0 commit comments

Comments
 (0)