|
@@ -30,7 +30,6 @@ import com.evernote.android.job.Job;
|
|
import com.evernote.android.job.util.support.PersistableBundleCompat;
|
|
import com.evernote.android.job.util.support.PersistableBundleCompat;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment;
|
|
import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment;
|
|
-import com.owncloud.android.utils.IOHelper;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -116,9 +115,7 @@ public class ContactsImportJob extends Job {
|
|
String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
|
|
String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
|
|
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
|
|
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
|
|
VCard vCard = null;
|
|
VCard vCard = null;
|
|
- InputStream inputStream = null;
|
|
|
|
- try {
|
|
|
|
- inputStream = getContext().getContentResolver().openInputStream(uri);
|
|
|
|
|
|
+ try (InputStream inputStream = getContext().getContentResolver().openInputStream(uri)){
|
|
ArrayList<VCard> vCardList = new ArrayList<>();
|
|
ArrayList<VCard> vCardList = new ArrayList<>();
|
|
vCardList.addAll(Ezvcard.parse(inputStream).all());
|
|
vCardList.addAll(Ezvcard.parse(inputStream).all());
|
|
if (vCardList.size() > 0) {
|
|
if (vCardList.size() > 0) {
|
|
@@ -127,8 +124,6 @@ public class ContactsImportJob extends Job {
|
|
|
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
Log_OC.d(TAG, e.getMessage());
|
|
Log_OC.d(TAG, e.getMessage());
|
|
- } finally {
|
|
|
|
- IOHelper.close(inputStream);
|
|
|
|
}
|
|
}
|
|
return vCard;
|
|
return vCard;
|
|
}
|
|
}
|