You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "Abhitocode (via GitHub)" <gi...@apache.org> on 2024/10/21 05:17:56 UTC

Re: [PR] Fix Business Calendar Usage [incubator-kie-kogito-runtimes]

Abhitocode commented on code in PR #3686:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3686#discussion_r1806516986


##########
jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java:
##########
@@ -103,38 +106,26 @@ public class BusinessCalendarImpl implements BusinessCalendar {
     public static final String WEEKEND_DAYS = "business.weekend.days";
     public static final String TIMEZONE = "business.cal.timezone";
 
-    private static final String DEFAULT_PROPERTIES_NAME = "/jbpm.business.calendar.properties";
-
     public BusinessCalendarImpl() {
-        String propertiesLocation = System.getProperty("jbpm.business.calendar.properties");
-
-        if (propertiesLocation == null) {
-            propertiesLocation = DEFAULT_PROPERTIES_NAME;
-        }
-        businessCalendarConfiguration = new Properties();
-
-        InputStream in = this.getClass().getResourceAsStream(propertiesLocation);
-        if (in != null) {
-
-            try {
-                businessCalendarConfiguration.load(in);
-            } catch (IOException e) {
-                logger.error("Error while loading properties for business calendar", e);
-
-            }
-        }
-        init();
-
+        this(null);
     }
 
     public BusinessCalendarImpl(Properties configuration) {
-        this.businessCalendarConfiguration = configuration;
-        init();
+        this(configuration, null);
     }
 
     public BusinessCalendarImpl(Properties configuration, SessionClock clock) {
-        this.businessCalendarConfiguration = configuration;
         this.clock = clock;
+        if (configuration == null) {
+            businessCalendarConfiguration = new Properties();
+            try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(BUSINESS_CALENDAR_PATH)) {
+                businessCalendarConfiguration.load(is);
+            } catch (IOException e) {
+                logger.error("Error while loading properties for business calendar", e);

Review Comment:
   @gitgabrio , Thank you for the detailed explanation : )
   I will make the required changes referring above .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org