Skip to content

Commit 309497c

Browse files
iroquetajotapeg
andauthored
Remove org.json lib fork and use new version of the API https://githu… (#865)
* Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 d844074 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Remove org.json lib fork and use new version of the API https://github.com/stleary/JSON-java Issue: 105607 * Fix SDTs instantiation not working in offline Android procedures * Rename Iterator variables * Remove org.json lib fork and use new version of the API https://github.com/steary/JSON-java --------- Co-authored-by: Juan Pablo González <jpgonzab@gmail.com>
1 parent 15891fb commit 309497c

File tree

89 files changed

+499
-5326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+499
-5326
lines changed

android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.genexus.GxSilentTrnSdt;
1010
import com.genexus.IGxSilentTrn;
1111

12-
import json.org.json.JSONArray;
12+
import org.json.JSONArray;
1313

1414
public class PendingEventHelper {
1515

android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.TreeMap;
44

5-
import json.org.json.JSONArray;
5+
import org.json.JSONArray;
66

77
public interface ISynchronizationHelper {
88

android/src/main/java/com/genexus/GXutil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.genexus.util.GXThreadLocal;
2222
import com.genexus.util.IThreadLocal;
2323

24-
import json.org.json.JSONObject;
24+
import org.json.JSONObject;
2525

2626
public final class GXutil
2727
{

android/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.genexus.db.driver;
22

3-
import json.org.json.JSONException;
4-
import json.org.json.JSONObject;
3+
import org.json.JSONException;
4+
import org.json.JSONObject;
55

66
public class ExternalProviderMetadata
77
{

android/src/main/java/com/genexus/internet/HttpAjaxContext.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import java.util.ArrayList;
44
import java.util.Stack;
55

6-
import json.org.json.IJsonFormattable;
7-
import json.org.json.JSONArray;
8-
import json.org.json.JSONException;
9-
import json.org.json.JSONObject;
6+
import org.json.JSONArray;
7+
import org.json.JSONException;
8+
import org.json.JSONObject;
109

1110
public abstract class HttpAjaxContext
1211
{
@@ -497,7 +496,7 @@ public Object GetJSONObject()
497496
return wrapper;
498497
}
499498

500-
public void FromJSONObject(IJsonFormattable obj)
499+
public void FromJSONObject(Object obj)
501500
{
502501
}
503502

android/src/main/java/com/genexus/internet/HttpContext.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
import com.genexus.util.Codecs;
1414
import com.genexus.util.Encryption;
1515

16-
import json.org.json.IJsonFormattable;
17-
import json.org.json.JSONArray;
18-
import json.org.json.JSONException;
19-
import json.org.json.JSONObject;
16+
import org.json.JSONArray;
17+
import org.json.JSONException;
18+
import org.json.JSONObject;
2019

2120
public abstract class HttpContext extends HttpAjaxContext implements IHttpContext
2221
{
@@ -613,7 +612,7 @@ public void ajax_req_read_hidden_sdt(String jsonStr, Object SdtObj)
613612
{
614613
try
615614
{
616-
IJsonFormattable jsonObj;
615+
Object jsonObj;
617616
if (jsonStr.startsWith("["))
618617
jsonObj = new JSONArray(jsonStr);
619618
else
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.genexus.specific.android;
2+
3+
import com.genexus.common.interfaces.IExtensionJSONSerialization;
4+
import com.genexus.json.JSONObjectWrapper;
5+
6+
import java.util.Iterator;
7+
import java.util.LinkedHashMap;
8+
import java.util.Map;
9+
10+
public class AndroidJSONSerialization implements IExtensionJSONSerialization {
11+
@Override
12+
public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
13+
Map<String, Object> map = new LinkedHashMap<>();
14+
for (Iterator<String> it = obj.keys(); it.hasNext(); ) {
15+
String k = it.next();
16+
map.put(k, null); // value is not used for now, so we just set it as null
17+
}
18+
19+
return map.entrySet().iterator();
20+
}
21+
}

android/src/main/java/com/genexus/specific/android/Connect.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import java.util.Date;
44

55
import com.genexus.common.interfaces.SpecificImplementation;
6-
import com.genexus.db.UserInformation;
76

8-
import json.org.json.IExtensionJSONObject;
9-
import json.org.json.JSONException;
10-
import json.org.json.JSONObject;
7+
import org.json.JSONException;
8+
import org.json.JSONObject;
119

1210
public final class Connect {
1311

@@ -34,35 +32,13 @@ public static void init()
3432
// connect GXSilentTrn
3533
SpecificImplementation.GXSilentTrnSdt = new GXSilentTrnSdt();
3634
SpecificImplementation.SdtMessages_Message = new SdtMessages_Message();
35+
SpecificImplementation.JsonSerialization = new AndroidJSONSerialization();
3736

3837
SpecificImplementation.KeepDecimals = true;
3938
SpecificImplementation.MillisecondMask = "SSS";
4039
SpecificImplementation.SupportPending = true;
4140
SpecificImplementation.cdowMask = "EEEE";
4241
SpecificImplementation.Base64Encode = "8859_1";
4342
SpecificImplementation.UseUnicodeCharacterClass = false;
44-
JSONObject.extension = new JSONObjectExtension();
45-
4643
}
47-
48-
static class JSONObjectExtension implements IExtensionJSONObject {
49-
50-
@Override
51-
public String dateToString(Date d) throws JSONException {
52-
if (d == null) {
53-
throw new JSONException("Null pointer");
54-
}
55-
UserInformation ui = (UserInformation) com.genexus.GXObjectHelper.getUserInformation(new com.genexus.ModelContext(com.genexus.ModelContext.getModelContextPackageClass()), -1);
56-
com.genexus.LocalUtil localUtil = ui.getLocalUtil();
57-
String dateString = localUtil.format(d, localUtil.getDateFormat() + " " + localUtil.getTimeFormat());
58-
try
59-
{
60-
com.genexus.db.DBConnectionManager.getInstance().disconnect(ui.getHandle());
61-
}
62-
catch (Throwable e)
63-
{}
64-
return dateString;
65-
}
66-
67-
}
6844
}

common/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<artifactId>opentelemetry-api</artifactId>
5151
<version>${io.opentelemetry.version}</version>
5252
</dependency>
53+
<dependency>
54+
<groupId>org.json</groupId>
55+
<artifactId>json</artifactId>
56+
<version>20231013</version>
57+
</dependency>
5358
</dependencies>
5459

5560
<build>

common/src/main/java/com/genexus/CommonUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.genexus.diagnostics.core.LogManager;
55
import com.genexus.util.*;
66

7-
import json.org.json.JSONObject;
7+
import org.json.JSONObject;
88

99
import java.math.BigDecimal;
1010
import java.io.*;

0 commit comments

Comments
 (0)