001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.bcel.classfile; 020 021/** 022 * 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. 023 */ 024public class ClassFormatException extends RuntimeException { 025 026 private static final long serialVersionUID = -3569097343160139969L; 027 028 /** 029 * 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 030 * {@link #initCause}. 031 */ 032 public ClassFormatException() { 033 } 034 035 /** 036 * Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to 037 * {@link #initCause}. 038 * 039 * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 040 */ 041 public ClassFormatException(final String message) { 042 super(message); 043 } 044 045 /** 046 * Constructs a new instance with the specified detail message and cause. 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}