1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * https://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.bcel.classfile;
20
21 /**
22 * 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.
23 */
24 public class ClassFormatException extends RuntimeException {
25
26 private static final long serialVersionUID = -3569097343160139969L;
27
28 /**
29 * 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
30 * {@link #initCause}.
31 */
32 public ClassFormatException() {
33 }
34
35 /**
36 * Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to
37 * {@link #initCause}.
38 *
39 * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
40 */
41 public ClassFormatException(final String message) {
42 super(message);
43 }
44
45 /**
46 * Constructs a new instance with the specified detail message and cause.
47 *
48 * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
49 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that
50 * the cause is nonexistent or unknown.
51 * @since 6.0
52 */
53 public ClassFormatException(final String message, final Throwable cause) {
54 super(message, cause);
55 }
56
57 /**
58 * Constructs a new instance with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the
59 * class and detail message of {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.
60 *
61 * @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
62 * cause is nonexistent or unknown.
63 * @since 6.7.0
64 */
65 public ClassFormatException(final Throwable cause) {
66 super(cause);
67 }
68 }