Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56150748 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Revert "Use scan mode introduced in VCardParser."

This reverts commit 51f6f77e.

Found that the change above is NOT related to the issue 2245363 and break the build.

Dr.NO: Hiroshi

Internal issue number: 2245363
parent ee455d5c
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.pim.vcard.VCardBuilderCollection;
import android.pim.vcard.VCardConfig;
import android.pim.vcard.VCardDataBuilder;
import android.pim.vcard.VCardEntryCounter;
import android.pim.vcard.VCardParser;
import android.pim.vcard.VCardParser_V21;
import android.pim.vcard.VCardParser_V30;
import android.pim.vcard.VCardSourceDetector;
@@ -204,15 +203,13 @@ public class ImportVCardActivity extends Activity {
                    boolean result;
                    try {
                        result = readOneVCardFile(mCanonicalPath,
                                VCardConfig.DEFAULT_CHARSET, builderCollection, null,
                                VCardParser.PARSER_MODE_SCAN, true, null);
                                VCardConfig.DEFAULT_CHARSET, builderCollection, null, true, null);
                    } catch (VCardNestedException e) {
                        try {
                            // Assume that VCardSourceDetector was able to detect the source.
                            // Try again with the detector.
                            result = readOneVCardFile(mCanonicalPath,
                                    VCardConfig.DEFAULT_CHARSET, counter,
                                    detector, VCardParser.PARSER_MODE_SCAN, false, null);
                                    VCardConfig.DEFAULT_CHARSET, counter, detector, false, null);
                        } catch (VCardNestedException e2) {
                            result = false;
                            Log.e(LOG_TAG, "Must not reach here. " + e2);
@@ -233,7 +230,7 @@ public class ImportVCardActivity extends Activity {
                    mProgressDialogForReadVCard.setIndeterminate(false);
                    mProgressDialogForReadVCard.setMax(counter.getCount());
                    String charset = detector.getEstimatedCharset();
                    doActuallyReadOneVCardFile(mCanonicalPath, null, charset, true, detector,
                    doActuallyReadOneVCard(mCanonicalPath, null, charset, true, detector,
                            mErrorFileNameList);
                } else {  // Read multiple files.
                    mProgressDialogForReadVCard.setProgressNumberFormat(
@@ -250,15 +247,14 @@ public class ImportVCardActivity extends Activity {
                        VCardSourceDetector detector = new VCardSourceDetector();
                        try {
                            if (!readOneVCardFile(canonicalPath, VCardConfig.DEFAULT_CHARSET,
                                    detector, null, VCardParser.PARSER_MODE_SCAN,
                                    true, mErrorFileNameList)) {
                                    detector, null, true, mErrorFileNameList)) {
                                continue;
                            }
                        } catch (VCardNestedException e) {
                            // Assume that VCardSourceDetector was able to detect the source.
                        }
                        String charset = detector.getEstimatedCharset();
                        doActuallyReadOneVCardFile(canonicalPath, mAccount,
                        doActuallyReadOneVCard(canonicalPath, mAccount,
                                charset, false, detector, mErrorFileNameList);
                        mProgressDialogForReadVCard.incrementProgressBy(1);
                    }
@@ -290,7 +286,7 @@ public class ImportVCardActivity extends Activity {
            }
        }

        private boolean doActuallyReadOneVCardFile(String canonicalPath, Account account,
        private boolean doActuallyReadOneVCard(String canonicalPath, Account account,
                String charset, boolean showEntryParseProgress,
                VCardSourceDetector detector, List<String> errorFileNameList) {
            final Context context = ImportVCardActivity.this;
@@ -313,8 +309,7 @@ public class ImportVCardActivity extends Activity {
            }

            try {
                if (!readOneVCardFile(canonicalPath, charset, builder, detector,
                        VCardParser.PARSER_MODE_DEFAULT, false, null)) {
                if (!readOneVCardFile(canonicalPath, charset, builder, detector, false, null)) {
                    return false;
                }
            } catch (VCardNestedException e) {
@@ -323,17 +318,14 @@ public class ImportVCardActivity extends Activity {
            return true;
        }

        /**
         * TODO: clean up input arguments...
         */
        private boolean readOneVCardFile(String canonicalPath, String charset,
                VCardBuilder builder, VCardSourceDetector detector,
                int parseMode, boolean throwNestedException, List<String> errorFileNameList)
                boolean throwNestedException, List<String> errorFileNameList)
                throws VCardNestedException {
            FileInputStream is;
            try {
                is = new FileInputStream(canonicalPath);
                mVCardParser = new VCardParser_V21(detector, parseMode);
                mVCardParser = new VCardParser_V21(detector);

                try {
                    mVCardParser.parse(is, charset, builder, mCanceled);