File tree Expand file tree Collapse file tree
knowagedao/src/main/java/it/eng/spagobi/profiling/bo Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919package it .eng .spagobi .profiling .bo ;
2020
21+ import java .lang .reflect .Constructor ;
22+ import java .lang .reflect .InvocationTargetException ;
23+ import java .lang .reflect .Method ;
2124import java .util .ArrayList ;
2225import java .util .Collection ;
2326import 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 () {
You can’t perform that action at this time.
0 commit comments