001 /*
002 * Copyright 2010 The Apache Software Foundation.
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 * http://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 */
016 package org.vafer.jdeb.descriptors;
017
018 public final class InvalidDescriptorException extends Exception {
019
020 private static final long serialVersionUID = 1L;
021 private final AbstractDescriptor desc;
022
023 public InvalidDescriptorException(AbstractDescriptor desc) {
024 this.desc = desc;
025 }
026
027 public InvalidDescriptorException(AbstractDescriptor desc, String message) {
028 super(message);
029 this.desc = desc;
030 }
031
032 public InvalidDescriptorException(AbstractDescriptor desc, Throwable cause) {
033 super(cause);
034 this.desc = desc;
035 }
036
037 public InvalidDescriptorException(AbstractDescriptor desc, String message, Throwable cause) {
038 super(message, cause);
039 this.desc = desc;
040 }
041
042 public AbstractDescriptor getDescriptor() {
043 return desc;
044 }
045
046 public String toString() {
047 return "Invalid keys are " + desc.invalidKeys() + "\n" + desc;
048 }
049
050
051 }