发现jbpm BusinessCalendar的bug

本文分享了一个在BusinessCalendar中遇到的BUG,通过JUnit测试案例重现了问题,即添加两个工作小时后的时间出现较大偏差。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

BusinessCalendar真的是非常有用,让我们对付 刁难的客户时不用那么

心惊胆颤了,但今天竟然发现一个BUG,开始以为是自己的问题,到后来不得不

转到junit:

public void testyhb() throws Exception {  

   Calendar calendar = BusinessCalendar.getCalendar();
   calendar.set(Calendar.YEAR, 2005);
   calendar.set(Calendar.MONTH, Calendar.APRIL);
   calendar.set(Calendar.DAY_OF_MONTH, 4);
   calendar.set(Calendar.HOUR_OF_DAY, 11);
   calendar.set(Calendar.MINUTE, 35);
   calendar.set(Calendar.SECOND, 0);
   calendar.set(Calendar.MILLISECOND, 0);
   Date date1 = calendar.getTime();
   System.out.println(date1);

   Date date2 =
   businessCalendar.add(date1, new Duration("2 business hours"));

   System.out.println(date2); 

   }

run了一把:

20:26:30,046 [main] INFO  JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
20:26:30,187 [main] DEBUG JbpmConfiguration : creating jbpm configuration from input stream
Mon Apr 04 11:35:00 CST 2005
Tue Apr 05 10:35:00 CST 2005

差别是相-----当的大,看了看旁边的clover.jar,哎,clover也管不了这个呀。

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值