My Oracle Support Banner

Dynamic Logic Error : Java.lang.SecurityException: Restricted Method Invocation When Using Function "TimeUnit" (Doc ID 2761402.1)

Last updated on MARCH 26, 2021

Applies to:

Oracle Health Insurance Enterprise Policy Administration - Version 3.20.3.0.0 and later
Information in this document applies to any platform.

Symptoms

We have a function that calculates the amount of days between two dates.
We do the calculation using milliseconds and later converting it to days.
We used the library TimeUnit for that.

def amountOfDays = TimeUnit.DAYS.convert(milliSecs, TimeUnit.MILLISECONDS);

But now, OHI is declaring it restricted method.

ERROR
-----------------------
 java.lang.SecurityException: Restricted method invocation.
  at com.oracle.healthinsurance.support.dynamiclogic.groovy.SecureMetaClass.checkRestrictions(SecureMetaClass.java:212)
  at com.oracle.healthinsurance.support.dynamiclogic.groovy.SecureMetaClass.createPojoCallSite(SecureMetaClass.java:101)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:131)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:165)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
  at ohi.dynamiclogic.COMMON_FUNCTIONS.determineAge(ohi.dynamiclogic.COMMON_FUNCTIONS.groovy:23)
  at ohi.dynamiclogic.COMMON_FUNCTIONS$determineAge.callStatic(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:196)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:224)
  at ohi.dynamiclogic.age_tobacco_condition.AGE_TOBACCO_CONDITION.run(ohi.dynamiclogic.age_tobacco_condition.AGE_TOBACCO_CONDITION.groovy:4)
  at com.oracle.healthinsurance.support.dynamiclogic.internal.GroovyDynamicLogicExecutable.invoke(GroovyDynamicLogicExecutable.java:67)
  at com.oracle.healthinsurance.common.domain.internal.dynlogic.components.DynamicLogicExecutionServiceImpl.evaluate(DynamicLogicExecutionServiceImpl.java:125)
  at com.oracle.healthinsurance.common.domain.internal.dynlogic.components.DynamicLogicExecutionServiceImpl.evaluateConditionDynamicLogic(DynamicLogicExecutionServiceImpl.java:59)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.workbook.DimensionAwareRow.matchWithDynamicLogic(DimensionAwareRow.java:104)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.selection.BaseSelector.filterMatchedRows(BaseSelector.java:82)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.selection.AdjustmentSelector.performSelection(AdjustmentSelector.java:102)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.selection.AdjustmentSelector.performSelection(AdjustmentSelector.java:75)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.selection.AdjustmentSelector.performSelection(AdjustmentSelector.java:41)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.calculation.BaseCalculatePremiumService.getSelectionOutput(BaseCalculatePremiumService.java:490)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.calculation.BaseCalculatePremiumService.processCalculationSteps(BaseCalculatePremiumService.java:400)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.calculation.BaseCalculatePremiumService.calculatePremium(BaseCalculatePremiumService.java:202)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.calculation.CalculateExamplePremiumService.calculate(CalculateExamplePremiumService.java:36)
  at com.oracle.healthinsurance.policies.domain.internal.calculatepremium.components.calculation.BaseCalculateExamplePremiumService.calculatePremium(BaseCalculateExamplePremiumService.java:61)
  at com.oracle.healthinsurance.policies.domain.internal.entities.PolicyDomain.calculatePremium(PolicyDomain.java:318)
  at com.oracle.healthinsurance.policies.api.policy.PolicyApis.exampleCalculation(PolicyApis.java:343)
  at com.oracle.healthinsurance.policies.api.poli




STEPS
-----------------------
The issue can be reproduced at will with the following steps:

1) create a dynamic logic converting millisecond to days, using the function provided by the library TimeUnit

// def amountOfDays = TimeUnit.DAYS.convert(milliSecs, TimeUnit.MILLISECONDS);

2) Run this dynamic logic.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.