Skip to content

Commit d22e022

Browse files
committed
update Java version
1 parent 86bdcd5 commit d22e022

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

src/test/java/com/upokecenter/test/CBORObjectTest.java

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,20 +2488,22 @@ public void TestEncodeFloat64() {
24882488
}
24892489
}
24902490

2491+
public static final int[] EtbRanges = {
2492+
-24, 23, 1,
2493+
-256, -25, 2,
2494+
24, 255, 2,
2495+
256, 266, 3,
2496+
-266, -257, 3,
2497+
65525, 65535, 3,
2498+
-65536, -65525, 3,
2499+
65536, 65546, 5,
2500+
-65547, -65537, 5,
2501+
};
2502+
24912503
@Test
24922504
public void TestEncodeToBytes() {
24932505
// Test minimum data length
2494-
int[] ranges = {
2495-
-24, 23, 1,
2496-
-256, -25, 2,
2497-
24, 255, 2,
2498-
256, 266, 3,
2499-
-266, -257, 3,
2500-
65525, 65535, 3,
2501-
-65536, -65525, 3,
2502-
65536, 65546, 5,
2503-
-65547, -65537, 5,
2504-
};
2506+
int[] ranges = EtbRanges;
25052507
String[] bigRanges = {
25062508
"4294967285", "4294967295",
25072509
"4294967296", "4294967306",
@@ -9749,9 +9751,11 @@ public void TestAtJSONPointer() {
97499751
cbor = CBORObject.NewMap().Add("f/o", 0);
97509752
Assert.assertEquals(cbor.get("f/o"), cbor.AtJSONPointer("/f~1o"));
97519753
cbor = CBORObject.NewMap().Add("foo", CBORObject.NewMap().Add("bar",
9752-
345));
9754+
345));
97539755

9754-
Assert.assertEquals(CBORObject.FromObject(345), cbor.AtJSONPointer("/foo/bar"));
9756+
Assert.assertEquals(
9757+
CBORObject.FromObject(345),
9758+
cbor.AtJSONPointer("/foo/bar"));
97559759
cbor = CBORObject.NewMap().Add("foo", CBORObject.NewArray().Add(678));
97569760
Assert.assertEquals(CBORObject.FromObject(678), cbor.AtJSONPointer("/foo/0"));
97579761
try {
@@ -10360,7 +10364,7 @@ public static void TestParseNumberFxxLine(String line) {
1036010364

1036110365
public static void TestParseNumberFxx(
1036210366
String str,
10363-
short _f16,
10367+
short f16,
1036410368
int f32,
1036510369
long f64,
1036610370
String line) {
@@ -10370,6 +10374,9 @@ public static void TestParseNumberFxx(
1037010374
// System.out.println(str);
1037110375
return;
1037210376
}
10377+
if (CBORObject.FromObject(f16) == null) {
10378+
Assert.fail();
10379+
}
1037310380
CBORObject cbor = CBORDataUtilities.ParseJSONNumber(str,
1037410381
JSONOptionsDouble);
1037510382
if (cbor == null) {
@@ -10608,13 +10615,13 @@ public void TestFromJsonStringZeroWithHighExponent() {
1060810615
String decstr = "0E100441809235791722330759976";
1060910616
EDecimal ed = EDecimal.FromString(decstr);
1061010617
double dbl = ed.ToDouble();
10611-
Assert.assertEquals((double)0, dbl, 0);
10618+
Assert.assertEquals((double)0.0d, dbl, 0);
1061210619
AssertJSONDouble(decstr, "double", dbl);
1061310620
AssertJSONInteger(decstr, "intorfloat", 0);
1061410621
decstr = "0E1321909565013040040586";
1061510622
ed = EDecimal.FromString(decstr);
1061610623
dbl = ed.ToDouble();
10617-
Assert.assertEquals((double)0, dbl, 0);
10624+
Assert.assertEquals((double)0.0d, dbl, 0);
1061810625
AssertJSONDouble(decstr, "double", dbl);
1061910626
AssertJSONInteger(decstr, "intorfloat", 0);
1062010627
double dblnegzero = EFloat.FromString("-0").ToDouble();
@@ -10770,7 +10777,7 @@ public void TestFromJsonLeadingTrailingCTL() {
1077010777
}
1077110778
}
1077210779
// Trailing CTL
10773-
chars = new char[] { (char)0x31, (char)i};
10780+
chars = new char[] { (char)0x31, (char)i };
1077410781
str = new String(chars, 0, chars.length);
1077510782
if (i == 0x09 || i == 0x0d || i == 0x0a || i == 0x20) {
1077610783
try {

src/test/java/com/upokecenter/test/JSONWithComments.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ private CBORObject NextJSONString() {
6161
if (escaped) {
6262
return CBORObject.FromJSONString(js.substring(
6363
startIndex - 1, (
64-
startIndex - 1)+(endIndex - (startIndex - 1)))); }
65-
return
66-
CBORObject.FromObject(js.substring(startIndex, (startIndex)+((endIndex - 1) - startIndex)));
64+
startIndex - 1)+(endIndex - (startIndex - 1))));
65+
}
66+
return
67+
CBORObject.FromObject(js.substring(startIndex, (startIndex)+((endIndex - 1) - startIndex)));
6768
} else if (c == '\\') {
6869
this.index = idx++;
6970
escaped = true;

src/test/java/com/upokecenter/test/QueryStringHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private static String[] SplitAt(String s, String delimiter) {
1515
throw new IllegalArgumentException();
1616
}
1717
if (s == null || s.length() == 0) {
18-
return new String[] { ""};
18+
return new String[] { "" };
1919
}
2020
int index = 0;
2121
boolean first = true;
@@ -25,7 +25,7 @@ private static String[] SplitAt(String s, String delimiter) {
2525
int index2 = s.indexOf(delimiter, index);
2626
if (index2 < 0) {
2727
if (first) {
28-
return new String[] { s};
28+
return new String[] { s };
2929
}
3030
strings.add(s.substring(index));
3131
break;
@@ -202,7 +202,7 @@ public static List<String[]> ParseQueryString(
202202
}
203203
name = name.replace('+', ' ');
204204
value = value.replace('+', ' ');
205-
String[] pair = new String[] { name, value};
205+
String[] pair = new String[] { name, value };
206206
pairs.add(pair);
207207
}
208208
for (String[] pair : pairs) {
@@ -216,7 +216,7 @@ public static List<String[]> ParseQueryString(
216216
private static String[] GetKeyPath(String s) {
217217
int index = s.indexOf('[');
218218
if (index < 0) { // start bracket not found
219-
return new String[] { s};
219+
return new String[] { s };
220220
}
221221
ArrayList<String> path = new ArrayList<String>();
222222
path.add(s.substring(0, index - 0));

0 commit comments

Comments
 (0)