Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d844074
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 22, 2024
3b607ce
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 22, 2024
53eee0d
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 23, 2024
04003dc
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 23, 2024
11cfef3
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 23, 2024
8611985
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 24, 2024
6ae833f
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 24, 2024
9b79487
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 27, 2024
75563b2
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 27, 2024
95be0dc
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 28, 2024
a64fd32
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 28, 2024
5f66ab7
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 28, 2024
af1c60c
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 29, 2024
1555418
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 29, 2024
be49277
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 31, 2024
457df2a
Remove org.json lib fork and use new version of the API https://githu…
iroqueta May 31, 2024
bf106f1
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jun 6, 2024
1bae3d3
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jun 7, 2024
30fdb7f
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jun 7, 2024
8187fba
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jun 11, 2024
285c0db
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jun 24, 2024
48b1f68
Fix SDTs instantiation not working in offline Android procedures
jotapeg Jun 26, 2024
a2f506e
Rename Iterator variables
jotapeg Jun 26, 2024
4c4ee08
Remove org.json lib fork and use new version of the API https://githu…
iroqueta Jul 23, 2024
3bdb7fd
Merge branch 'master' into ReplaceJsonAPI
iroqueta Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.genexus.GxSilentTrnSdt;
import com.genexus.IGxSilentTrn;

import json.org.json.JSONArray;
import org.json.JSONArray;

public class PendingEventHelper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.TreeMap;

import json.org.json.JSONArray;
import org.json.JSONArray;

public interface ISynchronizationHelper {

Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/genexus/GXutil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.genexus.util.GXThreadLocal;
import com.genexus.util.IThreadLocal;

import json.org.json.JSONObject;
import org.json.JSONObject;

public final class GXutil
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.genexus.db.driver;

import json.org.json.JSONException;
import json.org.json.JSONObject;
import org.json.JSONException;
import org.json.JSONObject;

public class ExternalProviderMetadata
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import java.util.ArrayList;
import java.util.Stack;

import json.org.json.IJsonFormattable;
import json.org.json.JSONArray;
import json.org.json.JSONException;
import json.org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class HttpAjaxContext
{
Expand Down Expand Up @@ -497,7 +496,7 @@ public Object GetJSONObject()
return wrapper;
}

public void FromJSONObject(IJsonFormattable obj)
public void FromJSONObject(Object obj)
{
}

Expand Down
9 changes: 4 additions & 5 deletions android/src/main/java/com/genexus/internet/HttpContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
import com.genexus.util.Codecs;
import com.genexus.util.Encryption;

import json.org.json.IJsonFormattable;
import json.org.json.JSONArray;
import json.org.json.JSONException;
import json.org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class HttpContext extends HttpAjaxContext implements IHttpContext
{
Expand Down Expand Up @@ -613,7 +612,7 @@ public void ajax_req_read_hidden_sdt(String jsonStr, Object SdtObj)
{
try
{
IJsonFormattable jsonObj;
Object jsonObj;
if (jsonStr.startsWith("["))
jsonObj = new JSONArray(jsonStr);
else
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.genexus.specific.android;

import com.genexus.common.interfaces.IExtensionJSONSerialization;
import com.genexus.json.JSONObjectWrapper;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

public class AndroidJSONSerialization implements IExtensionJSONSerialization {
@Override
public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
Map<String, Object> map = new LinkedHashMap<>();
for (Iterator<String> it = obj.keys(); it.hasNext(); ) {
String k = it.next();
map.put(k, null); // value is not used for now, so we just set it as null
}

return map.entrySet().iterator();
}
}
30 changes: 3 additions & 27 deletions android/src/main/java/com/genexus/specific/android/Connect.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import java.util.Date;

import com.genexus.common.interfaces.SpecificImplementation;
import com.genexus.db.UserInformation;

import json.org.json.IExtensionJSONObject;
import json.org.json.JSONException;
import json.org.json.JSONObject;
import org.json.JSONException;
import org.json.JSONObject;

public final class Connect {

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

SpecificImplementation.KeepDecimals = true;
SpecificImplementation.MillisecondMask = "SSS";
SpecificImplementation.SupportPending = true;
SpecificImplementation.cdowMask = "EEEE";
SpecificImplementation.Base64Encode = "8859_1";
SpecificImplementation.UseUnicodeCharacterClass = false;
JSONObject.extension = new JSONObjectExtension();

}

static class JSONObjectExtension implements IExtensionJSONObject {

@Override
public String dateToString(Date d) throws JSONException {
if (d == null) {
throw new JSONException("Null pointer");
}
UserInformation ui = (UserInformation) com.genexus.GXObjectHelper.getUserInformation(new com.genexus.ModelContext(com.genexus.ModelContext.getModelContextPackageClass()), -1);
com.genexus.LocalUtil localUtil = ui.getLocalUtil();
String dateString = localUtil.format(d, localUtil.getDateFormat() + " " + localUtil.getTimeFormat());
try
{
com.genexus.db.DBConnectionManager.getInstance().disconnect(ui.getHandle());
}
catch (Throwable e)
{}
return dateString;
}

}
}
5 changes: 5 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<artifactId>opentelemetry-api</artifactId>
<version>${io.opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/com/genexus/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.genexus.diagnostics.core.LogManager;
import com.genexus.util.*;

import json.org.json.JSONObject;
import org.json.JSONObject;

import java.math.BigDecimal;
import java.io.*;
Expand Down
13 changes: 8 additions & 5 deletions common/src/main/java/com/genexus/GXBaseCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import com.genexus.xml.GXXMLSerializer;
import com.genexus.xml.XMLReader;
import com.genexus.xml.XMLWriter;
import com.genexus.json.JSONObjectWrapper;

import json.org.json.IJsonFormattable;
import json.org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;

public class GXBaseCollection<T extends GXXMLSerializable> extends GXSimpleCollection<T> {

Expand Down Expand Up @@ -223,15 +224,17 @@ public boolean add(T item)

@Override
@SuppressWarnings("unchecked")
public void FromJSONObject(IJsonFormattable obj)
public void FromJSONObject(Object obj)
{
this.clear();
JSONArray jsonArr = (JSONArray)obj;
for (int i = 0; i < jsonArr.length(); i++)
{
try
{
Object jsonObj = jsonArr.get(i);
Object jsonObj = jsonArr.get(i);
if (jsonObj instanceof JSONObject)
jsonObj = new JSONObjectWrapper((JSONObject)jsonObj);
Class[] parTypes = new Class[] {};
Object[] arglist = new Object[] {};
if (elementsType == null)
Expand All @@ -251,7 +254,7 @@ public void FromJSONObject(IJsonFormattable obj)

Constructor<T> constructor = elementsType.getConstructor(parTypes);
currObj = constructor.newInstance(arglist);
((IGxJSONAble)currObj).FromJSONObject((IJsonFormattable)jsonObj);
((IGxJSONAble)currObj).FromJSONObject(jsonObj);
}
add((T)currObj);
}
Expand Down
25 changes: 12 additions & 13 deletions common/src/main/java/com/genexus/GXSimpleCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
import com.genexus.internet.IGxJSONAble;
import com.genexus.internet.IGxJSONSerializable;
import com.genexus.internet.StringCollection;
import com.genexus.json.JSONArrayWrapper;
import com.genexus.util.GXMap;
import com.genexus.util.Quicksort;
import com.genexus.xml.XMLReader;

import com.genexus.xml.XMLWriter;

import json.org.json.IJsonFormattable;
import json.org.json.JSONArray;
import json.org.json.JSONException;
import org.json.JSONArray;
import org.json.JSONException;

public class GXSimpleCollection<T> extends GXBaseList<T> {

Expand All @@ -34,7 +33,7 @@ public class GXSimpleCollection<T> extends GXBaseList<T> {
protected String xmlElementsName;
protected String containedXmlNamespace = "";
protected int remoteHandle = -1;
protected JSONArray jsonArr = new JSONArray();
protected JSONArrayWrapper jsonArr = new JSONArrayWrapper();

public GXSimpleCollection()
{
Expand Down Expand Up @@ -980,7 +979,7 @@ public void tojson()
}
public void tojson(boolean includeState)
{
jsonArr = new JSONArray();
jsonArr = new JSONArrayWrapper();
int size = size();
for (int i = 0; i < size; i++)
{
Expand Down Expand Up @@ -1031,7 +1030,7 @@ public Object GetJSONObject(boolean includeState)
tojson(includeState);
return jsonArr;
}
public void FromJSONObject(IJsonFormattable obj)
public void FromJSONObject(Object obj)
{

this.clear();
Expand Down Expand Up @@ -1059,7 +1058,7 @@ public void FromJSONObject(IJsonFormattable obj)
{
Constructor constructor = elementsType.getConstructor(parTypes);
currObj = constructor.newInstance(arglist);
((IGxJSONAble)currObj).FromJSONObject((IJsonFormattable)jsonObj);
((IGxJSONAble)currObj).FromJSONObject(jsonObj);
}
if (IGxJSONSerializable.class.isAssignableFrom(elementsType))
{
Expand Down Expand Up @@ -1119,7 +1118,7 @@ public boolean fromJSonString(String s, GXBaseCollection<SdtMessages_Message> me
{
try
{
jsonArr = new JSONArray(s);
jsonArr = new JSONArrayWrapper(s);
FromJSONObject(jsonArr);
return true;
}
Expand All @@ -1145,7 +1144,7 @@ public void fromStringCollectionJsonString(String s)
this.clear();
try
{
jsonArr = new JSONArray(s);
jsonArr = new JSONArrayWrapper(s);
for (int i = 0; i < jsonArr.length(); i++)
{
JSONArray jsonObj = jsonArr.getJSONArray(i);
Expand Down Expand Up @@ -1225,7 +1224,7 @@ public void fromStringCollectionClientJsonString(String s)
{
this.clear();
try {
jsonArr = new JSONArray(s);
jsonArr = new JSONArrayWrapper(s);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand Down Expand Up @@ -1292,7 +1291,7 @@ private boolean processArray(GxUnknownObjectCollection oldParent, GxUnknownObjec

public JSONArray getRawJSONArray()
{
return jsonArr;
return (JSONArray)jsonArr;
}

// toString of GxUnknownObjectCollection as client proc expect, table info + rows.
Expand All @@ -1317,7 +1316,7 @@ public String toStringCollectionClientJsonString()
result = result + ",[";
GxUnknownObjectCollection tableCollection = (GxUnknownObjectCollection)super.get(i);
int tableCollectionSize = tableCollection.size();
jsonObj = new json.org.json.JSONArray();
jsonObj = new JSONArray();
for (int j = 1; j <= tableCollectionSize; j++)
{
jsonObj.put((StringCollection)tableCollection.item(j));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.genexus.common.interfaces;

import com.genexus.json.JSONObjectWrapper;

import java.util.Iterator;
import java.util.Map;

public interface IExtensionJSONSerialization {
Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.genexus.common.interfaces;

import json.org.json.JSONArray;
import org.json.JSONArray;

public interface IGXWebGrid {
Object GetJSONObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class SpecificImplementation {
public static IExtensionHTTPConnection HTTPConnection;
public static ICryptoAlhorithms Algorithms;
public static IExtensionModelContext ModelContext;
public static IExtensionJSONSerialization JsonSerialization;
public static boolean KeepDecimals;
public static String MillisecondMask;
public static boolean SupportPending;
Expand Down
6 changes: 3 additions & 3 deletions common/src/main/java/com/genexus/internet/GXHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import HTTPClient.URI;
import com.genexus.CommonUtil;
import com.genexus.common.interfaces.SpecificImplementation;
import json.org.json.JSONException;
import json.org.json.JSONObject;
import org.json.JSONException;
import com.genexus.json.JSONObjectWrapper;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
Expand Down Expand Up @@ -807,7 +807,7 @@ private String getContentTypeFromString(String value){

private boolean isJsonString(String value){
try {
JSONObject json = new JSONObject(value);
JSONObjectWrapper json = new JSONObjectWrapper(value);
return true;
} catch (JSONException e) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/com/genexus/internet/GXJSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.genexus.util.Codecs;

import json.org.json.*;
import com.genexus.json.JSONObjectWrapper;

public class GXJSONObject extends JSONObject
public class GXJSONObject extends JSONObjectWrapper
{
private boolean base64Encoded;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.genexus.CommonUtil;
import com.genexus.common.interfaces.SpecificImplementation;

import json.org.json.*;
import org.json.JSONArray;

import java.io.Serializable;

Expand Down
Loading
Loading