src/main/java/seedu/address/logic/parser/ParserUtil.java
public static ReadOnlyAddressBook parseImportFilePath(String filePath) throws IllegalValueException {
        requireNonNull(filePath);
        String trimmedFilePath = filePath.trim();

        try {
            Optional<ReadOnlyAddressBook> addressBookOptional = new XmlAddressBookStorage(trimmedFilePath)
                    .readAddressBook();

            if (addressBookOptional.isPresent()) {
                return addressBookOptional.get();
            } else {
                throw new FileNotFoundException();
            }
        } catch (FileNotFoundException e) {
            throw new IllegalValueException(MESSAGE_FILE_NOT_FOUND);
        } catch (Exception e) {
            throw new IllegalValueException(String.format(MESSAGE_INVALID_DATA, filePath));
        }
    }
/**
     * Parses {@code filePath} and retrieve an {@code ReadOnlyAddressBook} from the filepath and returns it.
     * Leading and trailing whitespaces will be trimmed.
     * @throws IllegalValueException if the specified file cannot be formed or it is not the proper addressbook xml
     * format.
     */
Parses  filePath and retrieve an  ReadOnlyAddressBook from the filepath and returns it.
Leading and trailing whitespaces will be trimmed.
@throws IllegalValueException if the specified file cannot be formed or it is not the proper addressbook xml
format.
Parses filePath and retrieve an ReadOnlyAddressBook from the filepath and returns it . Leading and trailing whitespaces will be trimmed . @throws IllegalValueException if the specified file cannot be formed or it is not the proper addressbook xml format .
public static ReadOnlyAddressBook parseImportFilePath(String filePath) throws IllegalValueException {
        requireNonNull(filePath);
        String trimmedFilePath = filePath.trim();
        try {
            Optional<ReadOnlyAddressBook> addressBookOptional = new XmlAddressBookStorage(trimmedFilePath)
                    .readAddressBook();
            if (addressBookOptional.isPresent()) {
                return addressBookOptional.get();
            } else {
                throw new FileNotFoundException();
            }
        } catch (FileNotFoundException e) {
            throw new IllegalValueException(MESSAGE_FILE_NOT_FOUND);
        } catch (Exception e) {
            throw new IllegalValueException(String.format(MESSAGE_INVALID_DATA, filePath));
        }
    }
public static ReadOnlyAddressBook parseImportFilePath ( String filePath ) throws IllegalValueException { requireNonNull ( filePath ) ; String trimmedFilePath = filePath . trim ( ) ; try { Optional < ReadOnlyAddressBook > addressBookOptional = new XmlAddressBookStorage ( trimmedFilePath ) . readAddressBook ( ) ; if ( addressBookOptional . isPresent ( ) ) { return addressBookOptional . get ( ) ; } else { throw new FileNotFoundException ( ) ; } } catch ( FileNotFoundException e ) { throw new IllegalValueException ( MESSAGE_FILE_NOT_FOUND ) ; } catch ( Exception e ) { throw new IllegalValueException ( String . format ( MESSAGE_INVALID_DATA , filePath ) ) ; } }
Parses {@code filePath} and retrieve an {@code ReadOnlyAddressBook} from the filepath and returns it.
Parses { @code filePath } and retrieve an { @code ReadOnlyAddressBook } from the filepath and returns it .