* @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);
}