Package net.sourceforge.cardme.vcard

Examples of net.sourceforge.cardme.vcard.VCardImpl


      f = it.get(5);
      assertEquals("X-MS-ASSISTANT", f.getExtendedName());
      assertEquals("Jenny", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
      List<VCardError> errors = vcard2.getErrors();
      for(int j = 0; j < errors.size(); j++) {
        System.out.println(errors.get(j).getErrorMessage());
        System.out.println(errors.get(j).getSeverity());
        System.out.println(StringUtil.formatException(errors.get(j).getError()));
      }
View Full Code Here


      f = it.get(8);
      assertEquals("X-ABUID", f.getExtendedName());
      assertEquals("6B29A774-D124-4822-B8D0-2780EC117F60:ABPerson", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
      List<VCardError> errors = vcard2.getErrors();
      for(int j = 0; j < errors.size(); j++) {
        System.out.println(errors.get(j).getErrorMessage());
        System.out.println(errors.get(j).getSeverity());
        System.out.println(StringUtil.formatException(errors.get(j).getError()));
      }
View Full Code Here

   * @return {@link VCard}
   * @throws VCardParseException
   */
  private VCard parseVCard(String vcardStr) throws VCardParseException
  {
    VCardImpl vcard = new VCardImpl();
    vcard.setThrowExceptions(false);
   
    String[] lines = vcardStr.split("\n");
    for (int i = 0; i < lines.length; i++) {
      String vLine = lines[i];
      VCardLine parsedLine = VCardLine.parse(vLine);
     
      if(parsedLine != null) {
        try {
          parseLine(parsedLine, vcard);
        }
        catch(VCardParseException vpe) {
          if(vcard.isThrowExceptions()) {
            throw vpe;
          }
          else {
            handleError(vcard, vpe.getMessage(), vpe, ErrorSeverity.WARNING);
          }
        }
      }
      else {
        if(vcard.isThrowExceptions()) {
          throw new VCardParseException("Invalid data in VCard on line "+i);
        }
        else {
          handleError(vcard, "Invalid data in VCard on line "+i, null, ErrorSeverity.FATAL);
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.cardme.vcard.VCardImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.