    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 *  Unless required by applicable law or agreed to in writing, software
    012 *  distributed under the License is distributed on an "AS IS" BASIS,
    013 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 *  See the License for the specific language governing permissions and
    015 *  limitations under the License.
    016 */
    017package org.apache.bcel.classfile;
    018
    019/**
    020 * Thrown when the BCEL attempts to read a class file and determines that a class is malformed or otherwise cannot be interpreted as a class file.
    021 */
    022public class ClassFormatException extends RuntimeException {
    023
    024    private static final long serialVersionUID = -3569097343160139969L;
    025
    026    /**
    027     * Constructs a new instance with {@code null} as its detail message. The cause is not initialized, and may subsequently be initialized by a call to
    028     * {@link #initCause}.
    029     */
    030    public ClassFormatException() {
    031    }
    032
    033    /**
    034     * Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to
    035     * {@link #initCause}.
    036     *
    037     * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
    038     */
    039    public ClassFormatException(final String message) {
    040        super(message);
    041    }
    042
    043    /**
    044     * Constructs a new instance with the specified detail message and cause.
    045     * <p>
    046     * Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated in this runtime exception's detail message.
    047     *
    048     * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
    049     * @param cause   the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that
    050     *                the cause is nonexistent or unknown.)
    051     * @since 6.0
    052     */
    053    public ClassFormatException(final String message, final Throwable cause) {
    054        super(message, cause);
    055    }
    056
    057    /**
    058     * Constructs a new instance with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the
    059     * class and detail message of {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.
    060     *
    061     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the
    062     *              cause is nonexistent or unknown.)
    063     * @since 6.7.0
    064     */
    065    public ClassFormatException(final Throwable cause) {
    066        super(cause);
    067    }
    068}