Skip to content

Commit 82fb07c

Browse files
author
dalvarellos
committed
Use package name from properties
1 parent c1ef05d commit 82fb07c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gxdynamiccall/src/main/java/com/genexus/gxdynamiccall/GXDynamicCall.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class GXDynamicCall {
2222
public GXDynamicCall(int remoteHandle, ModelContext context){
2323
this.remoteHandle = remoteHandle;
2424
this.context = context;
25+
this.properties = new GXProperties();
2526
}
2627

2728
public GXProperties getProperties() {
@@ -74,7 +75,7 @@ public Object execute(Vector<Object> parameters, GXDynCallMethodConf methodConfi
7475
{
7576
Class<?> auxClass=null;
7677
try {
77-
auxClass = Class.forName(this.externalName);
78+
auxClass = loadClass(this.externalName, properties.get("PackageName"));
7879
} catch (ClassNotFoundException e) {
7980
CommonUtil.ErrorToMessages("Load class Error", e.getMessage(), errors);
8081
errorsArray.addAll(errors.getStruct());
@@ -92,7 +93,7 @@ public void create(Vector<Object> constructParameters, Vector<SdtMessages_Messag
9293
Constructor<?> constructor=null;
9394
if (!this.externalName.isEmpty()) {
9495
try {
95-
Class<?> objClass = Class.forName(this.externalName);
96+
Class<?> objClass = loadClass(this.externalName, properties.get("PackageName"));
9697
Object[] auxConstParameters;
9798
Class<?>[] auxConstructorTypes;
9899
if (constructParameters != null && constructParameters.size() > 0) {
@@ -254,4 +255,13 @@ private static void updateParams(Vector<Object> originalParameter, Object[] call
254255
originalParameter.set(i, objectToUpdate);
255256
}
256257
}
258+
259+
private Class<?> loadClass(String className, String sPackage) throws ClassNotFoundException {
260+
String classPackage="";
261+
if(sPackage != null && !sPackage.isEmpty())
262+
classPackage+= sPackage + ".";
263+
classPackage+= className;
264+
Class<?> c = Class.forName(classPackage);;
265+
return c;
266+
}
257267
}

0 commit comments

Comments
 (0)