001/*
002 * MIT License
003 * 
004 * Copyright (c) 2016 Michael Angstadt
005 * 
006 * Permission is hereby granted, free of charge, to any person obtaining a copy
007 * of this software and associated documentation files (the "Software"), to deal
008 * in the Software without restriction, including without limitation the rights
009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
010 * copies of the Software, and to permit persons to whom the Software is
011 * furnished to do so, subject to the following conditions:
012 * 
013 * The above copyright notice and this permission notice shall be included in
014 * all copies or substantial portions of the Software.
015 * 
016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
022 * SOFTWARE.
023 */
024
025package com.github.mangstadt.vinnie.io;
026
027/**
028 * Lists the non-fatal problems that can occur when parsing a vobject data
029 * stream.
030 * @see VObjectDataListener#onWarning
031 * @author Michael Angstadt
032 */
033public enum Warning {
034        /**
035         * When a line cannot be parsed.
036         */
037        MALFORMED_LINE("Skipping malformed line (no colon character found)."),
038
039        /**
040         * When a BEGIN property value is empty (it is supposed to contain the name
041         * of a component).
042         */
043        EMPTY_BEGIN("Ignoring BEGIN property that does not have a component name."),
044
045        /**
046         * When an END property value is empty (it is supposed to contain the name
047         * of a component).
048         */
049        EMPTY_END("Ignoring END property that does not have a component name."),
050
051        /**
052         * When the component in an END property does not match up with any BEGIN
053         * properties.
054         */
055        UNMATCHED_END("Ignoring END property that does not match up with any BEGIN properties."),
056
057        /**
058         * When a VERSION property is not recognized by the parser's
059         * {@link SyntaxRules}.
060         */
061        UNKNOWN_VERSION("Unknown version number found. Treating it as a regular property."),
062
063        /**
064         * When a property value is encoded in quoted-printable encoding and its
065         * defined character set is not recognized by the JVM.
066         */
067        UNKNOWN_CHARSET("The property's character encoding is not supported by this system.  The value will be decoded into the default quoted-printable character encoding."),
068
069        /**
070         * When a property value cannot be decoded from quoted-printable encoding.
071         */
072        QUOTED_PRINTABLE_ERROR("Unable to decode the property's quoted-printable value.  Value will be treated as plain-text.");
073
074        private Warning(String message) {
075                this.message = message;
076        }
077
078        private String message;
079
080        /**
081         * Gets a message describing the warning.
082         * @return the message
083         */
084        public String getMessage() {
085                return message;
086        }
087
088        @Override
089        public String toString() {
090                return message;
091        }
092}