Skip to content

Commit 4f5a736

Browse files
authored
Merge branch 'master' into exceldoc-template-fix
2 parents 09d53b6 + 26f2584 commit 4f5a736

File tree

94 files changed

+4918
-291
lines changed

Some content is hidden

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

94 files changed

+4918
-291
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
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/GXExternalCollection.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ public <E> ArrayList<E> getExternalInstance() {
120120
public void setExternalInstance(ArrayList<?> data)
121121
{
122122
try {
123-
clear();
124-
for (Object item : data) {
125-
T obj = elementsType.getConstructor(new Class[]{}).newInstance();
126-
obj.getClass().getMethod("setExternalInstance", item.getClass()).invoke(obj, item);
127-
super.add(obj);
128-
vectorExternal.add(item);
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+
}
129131
}
130132
}
131133
catch(Exception ex)

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
}

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

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,34 @@ public static ILogger getMainLogger() {
1919
private static ILogger getLogger(String topic) {
2020
ILogger log;
2121
if (topic != null && topic.length() > 0) {
22-
String loggerName = topic.startsWith("$") ? topic.substring(1): String.format("%s.%s", defaultUserLogNamespace, topic.trim());
22+
String loggerName = topic.startsWith("$") ? topic.substring(1) : String.format("%s.%s", defaultUserLogNamespace, topic.trim());
2323
log = LogManager.getLogger(loggerName);
24-
}
25-
else {
24+
} else {
2625
log = getMainLogger();
2726
}
2827
return log;
2928
}
3029

31-
public static void write( int logLevel, String message, String topic) {
30+
public static void write(int logLevel, String message, String topic) {
3231
ILogger log = getLogger(topic);
32+
LogLevel level = LogLevel.fromInt(logLevel);
3333

34-
switch (logLevel) {
35-
case LogLevel.OFF: //LogLevel off
34+
switch (level) {
35+
case OFF: //LogLevel off
3636
break;
37-
case LogLevel.TRACE:
37+
case TRACE:
3838
log.trace(message);
3939
break;
40-
case LogLevel.DEBUG:
41-
log.debug(message);
42-
break;
43-
case LogLevel.INFO:
40+
case INFO:
4441
log.info(message);
4542
break;
46-
case LogLevel.WARNING:
43+
case WARN:
4744
log.warn(message);
4845
break;
49-
case LogLevel.ERROR:
46+
case ERROR:
5047
log.error(message);
5148
break;
52-
case LogLevel.FATAL:
49+
case FATAL:
5350
log.fatal(message);
5451
break;
5552
default:
@@ -120,4 +117,51 @@ public static void debug(String message, String topic) {
120117
public static void debug(String message, String topic, Throwable ex) {
121118
getLogger(topic).debug(message, ex);
122119
}
120+
121+
public static void setContext(String key, Object value) {
122+
// Topic is ignored, also if you put something
123+
getLogger("$").setContext(key, value);
124+
}
125+
126+
public static void write(String message, String topic, int logLevel, Object data, boolean stackTrace) {
127+
getLogger(topic).write(message, logLevel, data, stackTrace);
128+
}
129+
130+
public static void write(String message, String topic, int logLevel, Object data) {
131+
write(message, topic, logLevel, data, false);
132+
}
133+
134+
public static boolean isDebugEnabled() {
135+
return getLogger().isDebugEnabled();
136+
}
137+
138+
public static boolean isErrorEnabled() {
139+
return getLogger().isErrorEnabled();
140+
}
141+
142+
public static boolean isFatalEnabled() {
143+
return getLogger().isFatalEnabled();
144+
}
145+
146+
public static boolean isInfoEnabled() {
147+
return getLogger().isInfoEnabled();
148+
}
149+
150+
public static boolean isWarnEnabled() {
151+
return getLogger().isWarnEnabled();
152+
}
153+
154+
public static boolean isTraceEnabled() {
155+
return getLogger().isTraceEnabled();
156+
}
157+
158+
public static boolean isEnabled(int logLevel) {
159+
return getLogger().isEnabled(logLevel);
160+
}
161+
162+
public static boolean isEnabled(int logLevel, String topic) {
163+
return getLogger(topic).isEnabled(logLevel);
164+
}
165+
166+
123167
}

0 commit comments

Comments
 (0)