Skip to content

Commit fac6904

Browse files
authored
Merge branch 'master' into iam-s3v2
2 parents 67b9fc2 + 7fdd734 commit fac6904

File tree

235 files changed

+7566
-1412
lines changed

Some content is hidden

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

235 files changed

+7566
-1412
lines changed

.github/workflows/Build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
servers: '[
5656
{ "id": "github-genexuslabs", "username": "genexusbot", "password": "${{ secrets.SECURE_TOKEN }}" },
5757
{ "id": "azure-devops", "username": "genexuslabs", "password": "${env.AZURE_ARTIFACTS_TOKEN}" },
58-
{ "id": "ossrh", "username": "${env.MAVEN_USERNAME}", "password": "${env.MAVEN_PASSWORD}" },
58+
{ "id": "central", "username": "${env.MAVEN_USERNAME}", "password": "${env.MAVEN_PASSWORD}" },
5959
{ "id": "gpg.passphrase", "passphrase": "${env.MAVEN_GPG_PASSPHRASE}" }
6060
]'
6161

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
44
## Repo Status
55
| Branch | Build | Security
66
|---|---|---
7-
|master |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Amaster)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
8-
|beta |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Abeta)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
7+
|master |[![Build](https://github.com/genexuslabs/JavaClasses/actions/workflows/Build.yml/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions/workflows/Build.yml)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
8+
|beta |[![Build](https://github.com/genexuslabs/JavaClasses/actions/workflows/Build.yml/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions/workflows/Build.yml)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
99

1010
## Modules
1111

12-
| Name | Description
13-
|---|---
14-
| common | Classes common to Android and Java
15-
| gxcryptocommon | Classes common to Android and Java related to Cryptography
16-
| gxmail | Classes related to mail handling
17-
| java | Java standard classes, output is gxclassr.jar
18-
| wrappercommon | Interfaces to encapsulate Java EE and Jakarta EE support, output is gxwrappercommon.jar
19-
| wrapperjavax | Implement the interfaces defined in wrappercommon in Java EE, output is gxwrapperjavax.jar
20-
| wrapperjakarta | Implement the interfaces defined in wrappercommon in Jakarta EE, output is gxwrapperjakarta.jar
21-
| gxoffice | Formerly Java classes are now separated to be included only when using office.
22-
| gxsearch | Formerly in Java classes are now separated to be included only when using search.
12+
| Name | Description
13+
|--------------------------------|---
14+
| common | Classes common to Android and Java
15+
| gxcryptocommon | Classes common to Android and Java related to Cryptography
16+
| gxmail | Classes related to mail handling
17+
| java | Java standard classes, output is gxclassr.jar
18+
| wrappercommon | Interfaces to encapsulate Java EE and Jakarta EE support, output is gxwrappercommon.jar
19+
| wrapperjavax | Implement the interfaces defined in wrappercommon in Java EE, output is gxwrapperjavax.jar
20+
| wrapperjakarta | Implement the interfaces defined in wrappercommon in Jakarta EE, output is gxwrapperjakarta.jar
21+
| gxoffice | Formerly Java classes are now separated to be included only when using office.
22+
| gxsearch | Formerly in Java classes are now separated to be included only when using search.
2323
| gxandroidpublisher and javapns | They are necessary for when you have Push Notifications in your old implementation. These are projects that should disappear in the short term.
2424
| android | The standard Android classes. **Note that this is not the full runtime for Android, the full runtime can be created by using the Android Flexible Client project**.
2525
| gxexternalproviders | Implements service provider for IBM Cloud, Google, Azure, Amazon
@@ -31,6 +31,8 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
3131
| gxxmlsignature | SecurityAPI's GeneXusXmlSignature module
3232
| gxftps | SecurityAPI's GeneXusFTPS module
3333
| gxsftp | SecurityAPI's GeneXusSFTP module
34+
| gamutils | GAM external object with utilities
35+
| gamtotp | GAM external object for RFC6238 implementation
3436

3537
The dependencies between the projects are specified in each pom.xml within their directory.
3638

common/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
<dependency>
2929
<groupId>commons-codec</groupId>
3030
<artifactId>commons-codec</artifactId>
31-
<version>1.15</version>
31+
<version>${commons-codec.version}</version>
3232
</dependency>
3333
<dependency>
3434
<groupId>org.apache.commons</groupId>
3535
<artifactId>commons-lang3</artifactId>
36-
<version>3.17.0</version>
36+
<version>3.18.0</version>
3737
</dependency>
3838
<dependency>
3939
<groupId>commons-io</groupId>
4040
<artifactId>commons-io</artifactId>
41-
<version>2.11.0</version>
41+
<version>${commons-io.version}</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>org.bouncycastle</groupId>

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,4 +3490,69 @@ public static String Sanitize(String input, HashMap<Character, Character> whiteL
34903490
}
34913491
return sanitizedInput.toString();
34923492
}
3493+
3494+
3495+
public static boolean isKnownContentType(String type)
3496+
{
3497+
if (type != null)
3498+
{
3499+
for (int i = 0; i < contentTypes.length; i++)
3500+
{
3501+
if (contentTypes[i].length >= 2)
3502+
{
3503+
if (type.equalsIgnoreCase(contentTypes[i][1]))
3504+
return true;
3505+
}
3506+
}
3507+
}
3508+
return false;
3509+
}
3510+
3511+
public static String getContentFromExt( String extension)
3512+
{
3513+
if (extension != null)
3514+
{
3515+
extension = extension.toLowerCase();
3516+
for (int i = 0; i < contentTypes.length; i++) {
3517+
if (contentTypes[i][0].equals(extension.trim()))
3518+
return contentTypes[i][1];
3519+
}
3520+
}
3521+
return null;
3522+
}
3523+
3524+
private static final String contentTypes[][] = {
3525+
{"txt" , "text/plain"},
3526+
{"rtx" , "text/richtext"},
3527+
{"htm" , "text/html"},
3528+
{"html" , "text/html"},
3529+
{"xml" , "text/xml"},
3530+
{"aif" , "audio/x-aiff"},
3531+
{"au" , "audio/basic"},
3532+
{"wav" , "audio/wav"},
3533+
{"bmp" , "image/bmp"},
3534+
{"gif" , "image/gif"},
3535+
{"jpe" , "image/jpeg"},
3536+
{"jpeg" , "image/jpeg"},
3537+
{"jpg" , "image/jpeg"},
3538+
{"jfif" , "image/pjpeg"},
3539+
{"tif" , "image/tiff"},
3540+
{"tiff" , "image/tiff"},
3541+
{"png" , "image/x-png"},
3542+
{"3gp" , "video/3gpp"},
3543+
{"3g2" , "video/3gpp2"},
3544+
{"mpg" , "video/mpeg"},
3545+
{"mpeg" , "video/mpeg"},
3546+
{"mov" , "video/quicktime"},
3547+
{"qt" , "video/quicktime"},
3548+
{"avi" , "video/x-msvideo"},
3549+
{"exe" , "application/octet-stream"},
3550+
{"dll" , "application/x-msdownload"},
3551+
{"ps" , "application/postscript"},
3552+
{"pdf" , "application/pdf"},
3553+
{"svg" , "image/svg+xml"},
3554+
{"tgz" , "application/x-compressed"},
3555+
{"zip" , "application/x-zip-compressed"},
3556+
{"gz" , "application/x-gzip"}
3557+
};
34933558
}

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ public Vector getStruct()
9999
return struct;
100100
}
101101

102-
public ArrayList getExternalInstance() {
103-
ArrayList list = new ArrayList();
102+
@SuppressWarnings("unchecked")
103+
public <E> ArrayList<E> getExternalInstance() {
104+
ArrayList<E> list = new ArrayList<>();
104105
for (T Item : this)
105106
{
106107
try
107108
{
108-
list.add(Item.getClass().getMethod("getExternalInstance", new Class[]{}).invoke(Item));
109+
list.add((E) Item.getClass().getMethod("getExternalInstance", new Class[]{}).invoke(Item));
109110
}
110111
catch (Exception e)
111112
{
@@ -115,5 +116,25 @@ public ArrayList getExternalInstance() {
115116
return list;
116117
}
117118

119+
@SuppressWarnings("unchecked")
120+
public void setExternalInstance(ArrayList<?> data)
121+
{
122+
try {
123+
if (elementsType != null) {
124+
clear();
125+
for (Object item : data) {
126+
T obj = elementsType.getConstructor(new Class[]{}).newInstance();
127+
obj.getClass().getMethod("setExternalInstance", item.getClass()).invoke(obj, item);
128+
super.add(obj);
129+
vectorExternal.add(item);
130+
}
131+
}
132+
}
133+
catch(Exception ex)
134+
{
135+
ex.printStackTrace();
136+
}
137+
}
138+
118139
}
119140

common/src/main/java/com/genexus/diagnostics/Log.java

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,63 +7,60 @@ public class Log {
77
private static ILogger getLogger() {
88
return getLogger("");
99
}
10-
10+
1111
public static ILogger getMainLogger() {
1212
return LogManager.getLogger("com.genexus.logging");
1313
}
14-
14+
1515
private static ILogger getLogger(String topic) {
1616
ILogger log;
1717
if (topic != null && topic.length() > 0) {
1818
log = LogManager.getLogger(topic);
19-
}
20-
else {
19+
} else {
2120
log = getMainLogger();
2221
}
2322
return log;
2423
}
25-
24+
2625
public static void write(int logLevel, String message, String topic) {
2726
write(message, topic, logLevel);
2827
}
29-
28+
3029
public static void write(String message, String topic, int logLevel) {
3130
ILogger log = getLogger(topic);
32-
33-
switch (logLevel) {
34-
case LogLevel.OFF: //LogLevel off
31+
LogLevel level = LogLevel.fromInt(logLevel);
32+
33+
switch (level) {
34+
case OFF: //LogLevel off
3535
break;
36-
case LogLevel.TRACE:
36+
case TRACE:
3737
log.trace(message);
3838
break;
39-
case LogLevel.DEBUG:
40-
log.debug(message);
41-
break;
42-
case LogLevel.INFO:
39+
case INFO:
4340
log.info(message);
4441
break;
45-
case LogLevel.WARNING:
42+
case WARN:
4643
log.warn(message);
4744
break;
48-
case LogLevel.ERROR:
45+
case ERROR:
4946
log.error(message);
5047
break;
51-
case LogLevel.FATAL:
48+
case FATAL:
5249
log.fatal(message);
5350
break;
5451
default:
55-
log.debug(message);
56-
}
52+
log.debug(message);
53+
}
5754
}
58-
55+
5956
public static void write(String message) {
6057
getLogger().debug(message);
6158
}
62-
59+
6360
public static void write(String message, String topic) {
6461
getLogger(topic).debug(message);
6562
}
66-
63+
6764
public static void error(String message) {
6865
getLogger().error(message);
6966
}
@@ -87,7 +84,7 @@ public static void fatal(String message, String topic) {
8784
public static void fatal(String message, String topic, Throwable ex) {
8885
getLogger(topic).fatal(message, ex);
8986
}
90-
87+
9188
public static void warning(String message) {
9289
getLogger().warn(message);
9390
}
@@ -115,7 +112,7 @@ public static void debug(String message) {
115112
public static void debug(String message, String topic) {
116113
getLogger(topic).debug(message);
117114
}
118-
115+
119116
public static void debug(String message, String topic, Throwable ex) {
120117
getLogger(topic).debug(message, ex);
121118
}
Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
package com.genexus.diagnostics;
22

3-
public class LogLevel {
4-
5-
static final int OFF = 0;
6-
static final int TRACE = 1;
7-
static final int DEBUG = 5;
8-
static final int INFO = 10;
9-
static final int WARNING = 15;
10-
static final int ERROR = 20;
11-
static final int FATAL = 30;
12-
13-
3+
public enum LogLevel {
4+
OFF(0),
5+
TRACE(1),
6+
DEBUG(5),
7+
INFO(10),
8+
WARN(15),
9+
ERROR(20),
10+
FATAL(30);
11+
12+
private final int lvl;
13+
LogLevel(int lvl) { this.lvl = lvl; }
14+
public int intValue() { return lvl; }
15+
16+
public static LogLevel fromInt(int lvl) {
17+
for (LogLevel level : LogLevel.values()) {
18+
if (level.intValue() == lvl) {
19+
return level;
20+
}
21+
}
22+
return LogLevel.OFF;
23+
}
1424
}

0 commit comments

Comments
 (0)