Skip to content

Commit 98eb7f8

Browse files
committed
[KNOWAGE-8984] check if licenses have expired when retrieving the user
1 parent 06280de commit 98eb7f8

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

knowagedao/src/main/java/it/eng/spagobi/profiling/bo/UserInformationDTO.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
package it.eng.spagobi.profiling.bo;
2020

21+
import java.lang.reflect.Constructor;
22+
import java.lang.reflect.InvocationTargetException;
23+
import java.lang.reflect.Method;
2124
import java.util.ArrayList;
2225
import java.util.Collection;
2326
import java.util.Locale;
@@ -200,12 +203,24 @@ public void setEnterprise(boolean enterprise) {
200203

201204
private boolean isEnterpriseEdition() {
202205
try {
203-
Class.forName("it.eng.knowage.tools.servermanager.utils.LicenseManager");
204-
return true;
206+
Class<?> clazz = Class.forName("it.eng.knowage.tools.servermanager.utils.LicenseManager");
207+
Constructor<?> constructor = clazz.getDeclaredConstructor();
208+
constructor.setAccessible(true);
209+
210+
Object instance = constructor.newInstance();
211+
212+
Method method = clazz.getDeclaredMethod("areLicensesValid");
213+
214+
return (Boolean) method.invoke(instance);
215+
205216
} catch (ClassNotFoundException e) {
206217
return false;
207218
}
208-
}
219+
catch (InvocationTargetException | InstantiationException | IllegalAccessException |
220+
NoSuchMethodException e) {
221+
throw new SpagoBIRuntimeException("Cannot create LicenseManager instance", e);
222+
}
223+
}
209224

210225
@Override
211226
public String toString() {

0 commit comments

Comments
 (0)