mirror of
https://github.com/zxing/zxing.git
synced 2024-09-20 05:27:32 -07:00
To be safe, avoid static DateFormat even in single-thread Android context
This commit is contained in:
parent
a9cf1e91ec
commit
002aa47e01
|
@ -67,8 +67,6 @@ public final class HistoryManager {
|
||||||
|
|
||||||
private static final String[] ID_COL_PROJECTION = { DBHelper.ID_COL };
|
private static final String[] ID_COL_PROJECTION = { DBHelper.ID_COL };
|
||||||
private static final String[] ID_DETAIL_COL_PROJECTION = { DBHelper.ID_COL, DBHelper.DETAILS_COL };
|
private static final String[] ID_DETAIL_COL_PROJECTION = { DBHelper.ID_COL, DBHelper.DETAILS_COL };
|
||||||
private static final DateFormat EXPORT_DATE_TIME_FORMAT =
|
|
||||||
DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
|
|
||||||
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
|
@ -286,6 +284,7 @@ public final class HistoryManager {
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
DBHelper.TIMESTAMP_COL + " DESC");
|
DBHelper.TIMESTAMP_COL + " DESC");
|
||||||
|
|
||||||
|
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
|
||||||
StringBuilder historyText = new StringBuilder(1000);
|
StringBuilder historyText = new StringBuilder(1000);
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
|
|
||||||
|
@ -297,7 +296,7 @@ public final class HistoryManager {
|
||||||
// Add timestamp again, formatted
|
// Add timestamp again, formatted
|
||||||
long timestamp = cursor.getLong(3);
|
long timestamp = cursor.getLong(3);
|
||||||
historyText.append('"').append(massageHistoryField(
|
historyText.append('"').append(massageHistoryField(
|
||||||
EXPORT_DATE_TIME_FORMAT.format(new Date(timestamp)))).append("\",");
|
format.format(new Date(timestamp)))).append("\",");
|
||||||
|
|
||||||
// Above we're preserving the old ordering of columns which had formatted data in position 5
|
// Above we're preserving the old ordering of columns which had formatted data in position 5
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue