Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Issue With Java code in UDF

$
0
0

Hi All,

 

i have a very weird behaviour in SAP PI 7.0 with java code in UDF

 

the Code has  which will put Max Day of the month of the respective year (following the actual calendar) for a given date & month

 

Input (mm/yyyy)

What we want (yyyymmdd)

02/2016

20160229 (February 29 2016)

02/2015

20160228 (February 28 2015)

06/2015

201506230 (June 30 2015)

 

Below is the Java code

 

Calendar c = Calendar.getInstance();

int mon = Integer.parseInt(month)-1; //Month Starts from 0-Jan till 11-Dec in Java

int yr = Integer.parseInt(year);

 

         c.set(Calendar.MONTH, mon);

          c.set(Calendar.YEAR, yr);

int days = c.getActualMaximum(Calendar.DAY_OF_MONTH);

String lastDay = Integer.toString(days);

return (year+month+lastDay);



For Certain dates, For Example 02/2018 it is sent as 31022018 which is incorrect


I dont see any issue in Java code


Also This issue is very Rare Occurrence, It occured 250+ times in 750000 times


Please let me know if any one know any pointers about this.





Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>