in our code, we need to parse date/time format using SimpleDateFormat class, so if IthreadA is parsing a value while threadB is changing the pattern, then error message bellowing could happen,"occasionally":
java.lang.NumberFormatException: For input string: ""So, we just simply change the definition of SimpleDateFormat object from class variable to local variable, this problem have been solved!
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:424)
at java.lang.Long.parseLong(Long.java:461)
at java.text.DigitList.getLong(DigitList.java:167)
at java.text.DecimalFormat.parse(DecimalFormat.java:1271)
at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1375)
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1124)
at java.text.DateFormat.parse(DateFormat.java:333)
at com.XXXX.struts.DateConverter.convert(DateConverter.java:41)
at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:428)
"This is a pitfall from JDK" :) I am not sure how many of you already release it....
You can look at the interesting article from Brian Goetz
http://www.ibm.com/developerworks/java/library/j-jtp09263.html
No comments:
Post a Comment