| package org.apache.log4j.helpers; |
| import java.util.Calendar; |
| import java.util.TimeZone; |
| import java.util.Date; |
| import java.text.FieldPosition; |
| import java.text.ParsePosition; |
| public |
| class ISO8601DateFormat |
| extends AbsoluteTimeDateFormat |
| { |
| private static final |
| long serialVersionUID |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.serialVersionUID: Interval 0 : -759840745298760000 : -759840745298760000 |
| =-759840745298755296L |
| ; |
| public |
| ISO8601DateFormat |
| ( |
| ) |
| { |
| } |
| public |
| ISO8601DateFormat |
| ( |
| TimeZone timeZone |
| ) |
| //QC Intervals :(TimeZone) org.apache.log4j.helpers.ISO8601DateFormat.ISO8601DateFormat.timeZone: Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| super(timeZone); |
| //type of the function/method : AbsoluteTimeDateFormat |
| } |
| static private |
| long lastTime |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.lastTime : Interval 0 : -9.2233720368548E+18 : 9.2233720368548E+18 |
| ; |
| static private |
| char[] lastTimeString |
| //QC Intervals : (char[]) org.apache.log4j.helpers.ISO8601DateFormat.lastTimeString: Interval 0 : new : new |
| =new char[20] |
| ; |
| public |
| StringBuffer format |
| //QC Intervals :(StringBuffer) org.apache.log4j.helpers.ISO8601DateFormat.format : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| ( |
| Date date |
| , |
| StringBuffer sbuf |
| , |
| FieldPosition fieldPosition |
| ) |
| //QC Intervals : (Date) org.apache.log4j.helpers.ISO8601DateFormat.format.date : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| //QC Intervals :(StringBuffer) org.apache.log4j.helpers.ISO8601DateFormat.format.sbuf : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| //QC Intervals :(FieldPosition) org.apache.log4j.helpers.ISO8601DateFormat.format.fieldPosition: Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| long now=date.getTime(); |
| //QC-CWE476 or QCerrorNPE null pointer reference on date (see http://cwe.mitre.org/data/definitions/476.html) |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.format.now : Interval 0 : -9.2233720368548E+18 : 9.2233720368548E+18 |
| int millis=(int )(now%1000); |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.millis: Interval 0 : 0 : 0 |
| if ((now-millis)!=lastTime) |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.format.now : Interval 0 : -9.2233720368548E+18 : -1 |
| //QC : Interval 1 : 0 : 0 |
| //QC : Interval 2 : 1 : 9.2233720368548E+18 |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.millis: Interval 0 : 0 : 0 |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.lastTime |
| : Interval 0 : -9.2233720368548E+18 : 9.2233720368548E+18 |
| { |
| calendar.setTime(date); |
| //type of the function/method : TypeInconnu |
| int start=sbuf.length(); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.start: Interval 0 : -2147483647 : 2147483647 |
| int year=calendar.get(Calendar.YEAR); |
| //QC Intervals : (Object) sun.util.calendar |
| 1 : Interval 0 : 1 : 1 |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.year : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| sbuf.append(year); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| String month; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| switch (calendar.get(Calendar.MONTH)){ |
| case Calendar.JANUARY: |
| //QC Intervals : (V) sun.util.calendar |
| : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| //QC Intervals : (int) java.util.Calendar.JANUARY |
| : Interval 0 : 0 : 0 |
| month=" - 01 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 01 - : - 01 - |
| //assignation |
| break ; |
| case Calendar.FEBRUARY: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.FEBRUARY |
| month=" - 02 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 02 - : - 02 - |
| //assignation |
| break ; |
| case Calendar.MARCH: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.MARCH |
| month=" - 03 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 03 - : - 03 - |
| //assignation |
| break ; |
| case Calendar.APRIL: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.APRIL |
| month=" - 04 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 04 - : - 04 - |
| //assignation |
| break ; |
| case Calendar.MAY: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.MAY |
| month=" - 05 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 05 - : - 05 - |
| //assignation |
| break ; |
| case Calendar.JUNE: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.JUNE |
| month=" - 06 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 06 - : - 06 - |
| //assignation |
| break ; |
| case Calendar.JULY: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.JULY |
| month=" - 07 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 07 - : - 07 - |
| //assignation |
| break ; |
| case Calendar.AUGUST: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.AUGUST |
| month=" - 08 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 08 - : - 08 - |
| //assignation |
| break ; |
| case Calendar.SEPTEMBER: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.SEPTEMBER |
| month=" - 09 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 09 - : - 09 - |
| //assignation |
| break ; |
| case Calendar.OCTOBER: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.OCTOBER |
| month=" - 10 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 10 - : - 10 - |
| //assignation |
| break ; |
| case Calendar.NOVEMBER: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.NOVEMBER |
| month=" - 11 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 11 - : - 11 - |
| //assignation |
| break ; |
| case Calendar.DECEMBER: |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (V)sun.util.calendar |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)java.util.Calendar.DECEMBER |
| month=" - 12 - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - 12 - : - 12 - |
| //assignation |
| break ; |
| default : |
| month=" - NA - "; |
| //QC Intervals : (String) org.apache.log4j.helpers.ISO8601DateFormat.format.month: Interval 0 : - NA - : - NA - |
| //assignation |
| break ; |
| } |
| sbuf.append(month); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| int day=calendar.get(Calendar.DAY_OF_MONTH); |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.day : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| if (day<10) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.day : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(day); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(' '); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| int hour=calendar.get(Calendar.HOUR_OF_DAY); |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.hour : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| if (hour<10) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.hour : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| } |
| sbuf.append(hour); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(' : '); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| int mins=calendar.get(Calendar.MINUTE); |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.mins : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| if (mins<10) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.mins : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| } |
| sbuf.append(mins); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(' : '); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| int secs=calendar.get(Calendar.SECOND); |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.secs : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| if (secs<10) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.secs : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| } |
| sbuf.append(secs); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(' , '); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.getChars(start,sbuf.length(),lastTimeString,0); |
| //QC Intervals : (int) java.lang.StringBuffer.getChars |
| 1 : Interval 0 : -2147483647 : 2147483647 |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //QC Intervals : (int) java.lang.StringBuffer.getChars |
| 2 : Interval 0 : -2147483647 : 2147483647 |
| //QC Intervals : (char) java.lang.StringBuffer.getChars |
| 3 : Interval 0 : A : z |
| //QC Intervals : (int) java.lang.StringBuffer.getChars |
| 4 : Interval 0 : 0 : 0 |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : void |
| lastTime=(now-millis); |
| //QC Intervals : (long) org.apache.log4j.helpers.ISO8601DateFormat.lastTime |
| : Interval 0 : -9.2233720368548E+18 : -1 |
| //assignation |
| } |
| else |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (long)org.apache.log4j.helpers.ISO8601DateFormat.format.now |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (int)org.apache.log4j.helpers.ISO8601DateFormat.format.millis |
| //QC-CWE570 and QCerrorCNT Condition NEVER true : no interval for variable (long)org.apache.log4j.helpers.ISO8601DateFormat.lastTime |
| { |
| sbuf.append(lastTimeString); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| } |
| if (millis<100) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.millis: Interval 0 : 0 : 0 |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| if (millis<10) |
| //QC Intervals : (int) org.apache.log4j.helpers.ISO8601DateFormat.format.millis: Interval 0 : 0 : 0 |
| sbuf.append('0'); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| sbuf.append(millis); |
| //QC-CWE476 or QCerrorNPE null pointer reference on sbuf (see http://cwe.mitre.org/data/definitions/476.html) |
| //type of the function/method : TypeInconnu |
| return sbuf; |
| //QC Intervals :(StringBuffer) org.apache.log4j.helpers.ISO8601DateFormat.format.return: Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| } |
| public |
| Date parse |
| //QC Intervals : (Date) org.apache.log4j.helpers.ISO8601DateFormat.parse : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| ( |
| java.lang.String s |
| , |
| ParsePosition pos |
| ) |
| //QC Intervals :(java.lang.String) org.apache.log4j.helpers.ISO8601DateFormat.parse.s : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| //QC Intervals :(ParsePosition) org.apache.log4j.helpers.ISO8601DateFormat.parse.pos : Interval 0 : null : null |
| //QC : Interval 1 : new : new |
| { |
| return null ; |
| //QC Intervals : (Date) org.apache.log4j.helpers.ISO8601DateFormat.parse.return: Interval 0 : null : null |
| } |
| } |