001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.core.codec;
017
018import org.springframework.lang.Nullable;
019
020/**
021 * Indicates an issue with decoding the input stream with a focus on content
022 * related issues such as a parse failure. As opposed to more general I/O
023 * errors, illegal state, or a {@link CodecException} such as a configuration
024 * issue that a {@link Decoder} may choose to raise.
025 *
026 * <p>For example in server web application, a {@code DecodingException} would
027 * translate to a response with a 400 (bad input) status while
028 * {@code CodecException} would translate to 500 (server error) status.
029 *
030 * @author Rossen Stoyanchev
031 * @since 5.0
032 * @see Decoder
033 */
034@SuppressWarnings("serial")
035public class DecodingException extends CodecException {
036
037        /**
038         * Create a new DecodingException.
039         * @param msg the detail message
040         */
041        public DecodingException(String msg) {
042                super(msg);
043        }
044
045        /**
046         * Create a new DecodingException.
047         * @param msg the detail message
048         * @param cause root cause for the exception, if any
049         */
050        public DecodingException(String msg, @Nullable Throwable cause) {
051                super(msg, cause);
052        }
053
054}