j256 / ormlite-core

Core ORMLite functionality that provides a lite Java ORM in conjunction with ormlite-jdbc or ormlite-android
http://ormlite.com/
ISC License
577 stars 212 forks source link

BaseDateType can result in multiple threads accessing the same SimpleDateFormat #211

Closed j256 closed 3 years ago

j256 commented 3 years ago

In version 5.4 of the ORMLite, there was support added for different SQL date formats that incorrectly accessed the SimpleDateFormat instead of calling the clone() version. This can cause NumberFormatException.

FloatingDecimal.readJavaFormatString(String) line: not available    
FloatingDecimal.parseDouble(String) line: not available 
Double.parseDouble(String) line: not available  
DigitList.getDouble() line: not available [local variables unavailable] 
DecimalFormat.parse(String, ParsePosition) line: not available  
SimpleDateFormat.subParse(String, int, int, int, boolean, boolean[], ParsePosition, boolean, CalendarBuilder) line: not available   
SimpleDateFormat.parse(String, ParsePosition) line: not available   
SimpleDateFormat(DateFormat).parse(String) line: not available  
BaseDateType.parseDateString(BaseDateType$DateStringFormatConfig, String) line: 47  
DateStringType.sqlArgToJava(FieldType, Object, int) line: 62    
DateStringType(BaseFieldConverter).resultToJava(FieldType, DatabaseResults, int) line: 30   
FieldType.resultToJava(DatabaseResults, Map<String,Integer>) line: 846  
MappedQueryForFieldEq<T,ID>(BaseMappedQuery<T,ID>).mapRow(DatabaseResults) line: 62 
...