We're updating the issue view to help you get more done. 

Multiple call sites to Calendar for loading a single string

Description

I've noticed that there are a few places in the code that create a Calendar instance for loading a single string. This may be a source of inefficiency. For example:

DateTimePatternGenerator.java:

1 String dateTimeFormat = Calendar.getDateTimePattern(Calendar.getInstance(uLocale), uLocale, DateFormat.MEDIUM);

SimpleDateFormat.java:

1 2 3 Calendar cal = Calendar.getInstance(cachedDefaultLocale); // ... String resourcePath = "calendar/" + cal.getType() + "/DateTimePatterns";

DateFormat.java:

1 2 3 4 cal = Calendar.getInstance(loc); // ... DateFormat result = cal.getDateTimeFormat(dateStyle, timeStyle, loc); result.setLocale(cal.getLocale(ULocale.VALID_LOCALE), cal.getLocale(ULocale.ACTUAL_LOCALE));

In addition, there are several call sites to the related class CalendarData that are also inefficient. (CalendarData is going to be refactored as part of the ongoing data loading effort.)

Status

Assignee

Felipe Balbontín

Reporter

Shane Carr

Labels

None

Reviewer

None

Time Needed

Hours

Start date

None

Components

Priority

assess