Examples of VCardParseException


Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

        }
        else if(EncodingType.SEVEN_BIT.getType().equalsIgnoreCase(val)) {
          vcardType.setEncodingType(EncodingType.SEVEN_BIT);
        }
        else {
          throw new VCardParseException("Invalid encoding type \""+val+"\"");
        }
      }
      else if("LANGUAGE".equalsIgnoreCase(nam)) {
        vcardType.setLanguage(val);
      }
      else if("TYPE".equalsIgnoreCase(nam)) {
        switch(typeName)
        {
          case PHOTO:
          case LOGO:
          {
            if(vcardType instanceof PhotoFeature) {
              ImageMediaType mediaType = ImageMediaType.valueOf(val);
              if(mediaType == null){
                mediaType = new ImageMediaType(val, val, val);
              }
             
              ((PhotoFeature)vcardType).setImageMediaType(mediaType);
            }
           
            if(vcardType instanceof LogoFeature) {
              ImageMediaType mediaType = ImageMediaType.valueOf(val);
              if(mediaType == null){
                mediaType = new ImageMediaType(val, val, val);
              }
             
              ((LogoFeature)vcardType).setImageMediaType(mediaType);
            }
           
            break;
          }
         
          case SOUND:
          {
            if(vcardType instanceof SoundFeature) {
              AudioMediaType mediaType = AudioMediaType.valueOf(val);
              if(mediaType == null) {
                mediaType = new AudioMediaType(val, val, val);
              }
             
              ((SoundFeature)vcardType).setAudioMediaType(mediaType);
            }
           
            break;
          }
         
          case KEY:
          {
            if(vcardType instanceof KeyFeature) {
              KeyTextType keyTextType = KeyTextType.valueOf(val);
              if(keyTextType == null) {
                keyTextType = new KeyTextType(val, val, val);
              }
             
              ((KeyFeature)vcardType).setKeyTextType(keyTextType);
            }
           
            break;
          }
         
          case ADR:
          {
            if(vcardType instanceof AdrFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = val.split(",");
                for(String typeValue : typeValueList) {
                  setAdrParamType((AdrType)vcardType, typeValue);
                }
              }
              else {
                setAdrParamType((AdrType)vcardType, val);
              }
            }
           
            break;
          }
         
          case LABEL:
          {
            if(vcardType instanceof LabelFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = val.split(",");
                for(String typeValue : typeValueList) {
                  setLabelParamType((LabelType)vcardType, typeValue);
                }
              }
              else {
                setLabelParamType((LabelType)vcardType, val);
              }
            }
           
            break;
          }
         
          case TEL:
          {
            if(vcardType instanceof TelFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = pt.getValue().split(",");
                for(String typeValue : typeValueList) {
                  setTelParamType((TelType)vcardType, typeValue);
                }
              }
              else {
                setTelParamType((TelType)vcardType, val);
              }
            }
           
            break;
          }
         
          case EMAIL:
          {
            if(vcardType instanceof EmailFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = pt.getValue().split(",");
                for(String typeValue : typeValueList) {
                  setEmailParamType((EmailType)vcardType, typeValue);
                }
              }
              else {
                setEmailParamType((EmailType)vcardType, val);
              }
            }
           
            break;
          }
         
          case URL:
          {
            if(vcardType instanceof UrlFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = pt.getValue().split(",");
                for(String typeValue : typeValueList) {
                  setUrlParamType((UrlType)vcardType, typeValue);
                }
              }
              else {
                setUrlParamType((UrlType)vcardType, val);
              }
            }
           
            break;
          }
         
          case IMPP:
          {
            if(vcardType instanceof ImppFeature) {
              if(val.indexOf(',') != -1) {
                String[] typeValueList = pt.getValue().split(",");
                for(String typeValue : typeValueList) {
                  setImppParamType((ImppType)vcardType, typeValue);
                }
              }
              else {
                setImppParamType((ImppType)vcardType, val);
              }
            }
           
            break;
          }
         
          default:
          {
            if(val.indexOf(',') != -1) {
              String[] typeValueList = pt.getValue().split(",");
              for(String typeValue : typeValueList) {
                vcardType.addExtendedParam(new ExtendedParamType(nam, typeValue, VCardTypeName.XTENDED));
              }
            }
            else {
              vcardType.addExtendedParam(new ExtendedParamType(nam, val, VCardTypeName.XTENDED));
            }
           
            break;
          }
         
        }//switch type name
      }
      else if("VALUE".equalsIgnoreCase(nam)) {
        if("URI".equalsIgnoreCase(val)) {
          vcardType.setEncodingType(EncodingType.EIGHT_BIT);
        }
        else if("DATE".equalsIgnoreCase(val)) {
          switch(typeName)
          {
            case BDAY:
            {
              if(vcardType instanceof BDayFeature) {
                ((BDayFeature)vcardType).setParam(BDayParamType.DATE);
              }
             
              break;
            }
          }
        }
        else if("DATE-TIME".equalsIgnoreCase(val)) {
          switch(typeName)
          {
            case BDAY:
            {
              if(vcardType instanceof BDayFeature) {
                ((BDayFeature)vcardType).setParam(BDayParamType.DATE_TIME);
              }
             
              break;
            }
          }
        }
        else if("TEXT".equalsIgnoreCase(val)) {
          switch(typeName)
          {
            case TZ:
            {
              if(vcardType instanceof TzFeature) {
                ((TzType)vcardType).setParamType(TzParamType.TEXT);
              }
             
              break;
            }
          }
        }
        else if("UTC-OFFSET".equalsIgnoreCase(val)) {
          switch(typeName)
          {
            case TZ:
            {
              if(vcardType instanceof TzFeature) {
                ((TzType)vcardType).setParamType(TzParamType.UTC_OFFSET);
              }
             
              break;
            }
          }
        }
        else {
          throw new VCardParseException("Invalid value type \""+val+"\"");
        }
      }
      else {
        vcardType.addExtendedParam(new ExtendedParamType(nam, val, typeName));
      }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

          }
        }
      }
      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

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

        type = type.replaceAll("-", "_");
        vCardTypeName = VCardTypeName.valueOf(type);
      }
      catch(IllegalArgumentException iae) {
        if(vcard.isThrowExceptions()) {
          throw new VCardParseException(iae.getMessage(), iae);
        }
        else {
          handleError(vcard, "Unrecognizable type name \""+type+"\"", iae, ErrorSeverity.WARNING);
          return;
        }
      }
    }
   
    switch (vCardTypeName)
    {
      case BEGIN:
      {
        parseBeginType(group, value, vcard);
        break;
      }
     
      case END:
      {
        parseEndType(group, value, vcard);
        break;
      }
     
      case VERSION:
      {
        parseVersionType(group, value, vcard);
        break;
      }
     
      case FN:
      {
        parseFnType(group, value, paramTypes, vcard);
        break;
      }
     
      case N:
      {
        parseNType(group, value, paramTypes, vcard);
        break;
      }
     
      case NICKNAME:
      {
        parseNicknameType(group, value, paramTypes, vcard);
        break;
      }
     
      case PHOTO:
      {
        parsePhotoType(group, value, paramTypes, vcard);
        break;
      }
     
      case BDAY:
      {
        parseBDayType(group, value, paramTypes, vcard);
        break;
      }
     
      case ADR:
      {
        parseAdrType(group, value, paramTypes, vcard);
        break;
      }
     
      case LABEL:
      {
        parseLabelType(group, value, paramTypes, vcard);
        break;
      }
     
      case TEL:
      {
        parseTelType(group, value, paramTypes, vcard);
        break;
      }
     
      case EMAIL:
      {
        parseEmailType(group, value, paramTypes, vcard);
        break;
      }
     
      case MAILER:
      {
        parseMailerType(group, value, paramTypes, vcard);
        break;
      }
     
      case TZ:
      {
        parseTzType(group, value, paramTypes, vcard);
        break;
      }
     
      case GEO:
      {
        parseGeoType(group, value, paramTypes, vcard);
        break;
      }
     
      case TITLE:
      {
        parseTitleType(group, value, paramTypes, vcard);
        break;
      }
     
      case ROLE:
      {
        parseRoleType(group, value, paramTypes, vcard);
        break;
      }
     
      case LOGO:
      {
        parseLogoType(group, value, paramTypes, vcard);
        break;
      }
     
      case AGENT:
      {
        //TODO  parseAgentType(group, value, vcard);
        break;
      }
     
      case ORG:
      {
        parseOrgType(group, value, paramTypes, vcard);
        break;
      }
     
      case CATEGORIES:
      {
        parseCategoriesType(group, value, paramTypes, vcard);
        break;
      }
     
      case NOTE:
      {
        parseNoteType(group, value, paramTypes, vcard);
        break;
      }
     
      case PRODID:
      {
        parseProdIdType(group, value, paramTypes, vcard);
        break;
      }
     
      case REV:
      {
        parseRevType(group, value, paramTypes, vcard);
        break;
      }
     
      case SORT_STRING:
      {
        parseSortStringType(group, value, paramTypes, vcard);
        break;
      }
     
      case SOUND:
      {
        parseSoundType(group, value, paramTypes, vcard);
        break;
      }
     
      case UID:
      {
        parseUidType(group, value, paramTypes, vcard);
        break;
      }
     
      case URL:
      {
        parseUrlType(group, value, paramTypes, vcard);
        break;
      }
     
      case CLASS:
      {
        parseClassType(group, value, paramTypes, vcard);
        break;
      }
     
      case KEY:
      {
        parseKeyType(group, value, paramTypes, vcard);
        break;
      }
     
      case XTENDED:
      {
        parseXtendedType(group, value, type, paramTypes, vcard);
        break;
      }
     
      case NAME:
      {
        parseNameType(group, value, paramTypes, vcard);
        break;
      }
     
      case PROFILE:
      {
        parseProfileType(group, value, paramTypes, vcard);
        break;
      }
     
      case SOURCE:
      {
        parseSourceType(group, value, paramTypes, vcard);
        break;
      }
     
      case IMPP:
      {
        parseImppType(group, value, paramTypes, vcard);
        break;
      }

      default:
      {
        throw new VCardParseException("Unhandled VCard type \""+vCardTypeName.getType()+"\"");
      }
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

        }
       
        vcard.setBegin(beginType);
      }
      else {
        throw new VCardParseException("Invalid value for \"BEGIN\" type. Must be \"VCARD\"");
      }
    }
    catch(Exception ex) {
      throw new VCardParseException("BeginType ("+VCardTypeName.BEGIN.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

        }
       
        vcard.setEnd(endType);
      }
      else {
        throw new VCardParseException("Invalid value for \"END\" type. Must be \"VCARD\"");
      }
    }
    catch(Exception ex) {
      throw new VCardParseException("EndType ("+VCardTypeName.END.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

      }
      else if(VCardVersion.V4_0.getVersion().compareTo(value) == 0) {
        versionType.setVersion(VCardVersion.V4_0);
      }
      else {
        throw new VCardParseException("Invalid value for \"VERSION\" type. Must be 2.1 or 3.0 or 4.0]");
      }
     
      if(group != null) {
        versionType.setGroup(group);
      }
     
      vcard.setVersion(versionType);
    }
    catch(Exception ex) {
      throw new VCardParseException("VersionType ("+VCardTypeName.VERSION.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

      }
     
      vcard.setFN(fnType);
    }
    catch(Exception ex) {
      throw new VCardParseException("FNType ("+VCardTypeName.FN.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

      }

      vcard.setN(nType);
    }
    catch(Exception ex) {
      throw new VCardParseException("NType ("+VCardTypeName.N.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

      }
     
      vcard.setNickname(nicknameType);
    }
    catch(Exception ex) {
      throw new VCardParseException("NicknameType ("+VCardTypeName.NICKNAME.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.exceptions.VCardParseException

      }
     
      vcard.addPhoto(photoType);
    }
    catch(Exception ex) {
      throw new VCardParseException("PhotoType ("+VCardTypeName.PHOTO.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.