/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/VcardImporter.java

  • Committer: Tim Marston
  • Date: 2016-03-28 18:18:11 UTC
  • Revision ID: tim@ed.am-20160328181811-as61lllmvnv8e5os
handle vcards with missing vesion lines (treat as v2.1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
                                                                R.string.error_vcf_notenoughinfo ).toString() );
253
253
                                                skipContact();
254
254
                                        }
 
255
                                        catch( Vcard.SkipImportException e ) {
 
256
                                                skipContact();
 
257
                                        }
255
258
 
256
259
                                        // discard this vcard
257
260
                                        vcard = null;
1035
1038
                }
1036
1039
 
1037
1040
                public void finaliseVcard()
1038
 
                        throws ParseException, ContactNotIdentifiableException
 
1041
                        throws ParseException, ContactNotIdentifiableException,
 
1042
                                SkipImportException, AbortImportException
1039
1043
                {
1040
 
                        // missing version (and data is present)
1041
 
                        if( _version == null && _content_lines != null )
1042
 
                                throw new ParseException( R.string.error_vcf_malformed );
 
1044
                        // if there was content present, but no version line, then it must
 
1045
                        // be a version 2.1 vCard; process that content now
 
1046
                        if( _version == null && _content_lines != null ) {
 
1047
                                _version = "2.1";
 
1048
                                for( int i = 0; i < _content_lines.size(); i++ )
 
1049
                                        parseLine( _content_lines.get( i ) );
 
1050
                                _content_lines = null;
 
1051
                        }
1043
1052
 
1044
1053
                        // finalise the parent class
1045
1054
                        finalise();