From 0dd32c1b27947dc772cebd1b3229c796746150ef Mon Sep 17 00:00:00 2001 From: Daisuke Miyakawa Date: Tue, 6 Oct 2009 09:25:52 -0700 Subject: Make VCardComposer create the instance for mHandlerList. Previously the creation was delayed until addHandler(), which had been required to be called. However, after VCardComoser's support toward PBAP stuffs, the guarantee was not true any more. So by creating the instance in constructor, we refrain NPE during finalize() when PBAP uses VCardComposer. --- core/java/android/pim/vcard/VCardComposer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java index 7b75f4a..c4711f8 100644 --- a/core/java/android/pim/vcard/VCardComposer.java +++ b/core/java/android/pim/vcard/VCardComposer.java @@ -294,7 +294,7 @@ public class VCardComposer { private final String mCharsetString; private final String mVCardAttributeCharset; private boolean mTerminateIsCalled; - private List mHandlerList; + final private List mHandlerList; private String mErrorReason = NO_ERROR; @@ -371,6 +371,7 @@ public class VCardComposer { mUsesUtf8 = VCardConfig.usesUtf8(vcardType); mUsesShiftJis = VCardConfig.usesShiftJis(vcardType); mUsesQPToPrimaryProperties = VCardConfig.usesQPToPrimaryProperties(vcardType); + mHandlerList = new ArrayList(); if (mIsDoCoMo) { mCharsetString = CharsetUtils.charsetForVendor(SHIFT_JIS, "docomo").name(); @@ -420,9 +421,6 @@ public class VCardComposer { * Must call before {{@link #init()}. */ public void addHandler(OneEntryHandler handler) { - if (mHandlerList == null) { - mHandlerList = new ArrayList(); - } mHandlerList.add(handler); } -- cgit v1.1