/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: 2013-07-19 15:57:39 UTC
  • Revision ID: tim@ed.am-20130719155739-50w182nof760psos
Tags: 1.3.3
bump version no. to 1.3.3

Show diffs side-by-side

added added

removed removed

471
471
                private String extractCollonPartFromLine( ContentLine content_line,
472
472
                        boolean former )
473
473
                {
 
474
                        String ret = null;
 
475
 
474
476
                        // split line into name and value parts and check to make sure we
475
477
                        // only got 2 parts and that the first part is not zero in length
476
478
                        String[] parts = content_line.getUsAsciiLine().split( ":", 2 );
477
479
                        if( parts.length == 2 && parts[ 0 ].length() > 0 )
478
 
                                return parts[ former? 0 : 1 ].trim();
 
480
                                ret = parts[ former? 0 : 1 ];
479
481
 
480
 
                        return null;
 
482
                        return ret;
481
483
                }
482
484
 
483
485
                private String extractNameAndParamsFromLine( ContentLine content_line )
484
486
                {
485
 
                        return extractCollonPartFromLine( content_line, true );
 
487
                        return extractCollonPartFromLine( content_line, true ).trim();
486
488
                }
487
489
 
488
490
                private String extractValueFromLine( ContentLine content_line )
506
508
                                        name_and_params.equalsIgnoreCase( "VERSION" ) )
507
509
                                {
508
510
                                        // yes, get it!
509
 
                                        String value = extractValueFromLine( content_line );
510
 
                                        if( value == null || (
511
 
                                                !value.equals( "2.1" ) && !value.equals( "3.0" ) ) )
512
 
                                        {
 
511
                                        String value = extractValueFromLine( content_line ).trim();
 
512
                                        if( !value.equals( "2.1" ) && !value.equals( "3.0" ) )
513
513
                                                throw new ParseException( R.string.error_vcf_version );
514
 
                                        }
515
514
                                        _version = value;
516
515
 
517
516
                                        // parse any buffers we've been accumulating while we waited