001package org.apache.maven.tools.plugin.extractor.model;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.io.File;
023
024/**
025 * Exception when plugin metadata parsing occurred.
026 *
027 */
028public class PluginMetadataParseException
029    extends Exception
030{
031    /** serialVersionUID */
032    static final long serialVersionUID = 4022348153707995574L;
033
034    private final File metadataFile;
035
036    private final String originalMessage;
037
038    /**
039     * @param metadataFile could be null
040     * @param message could be null
041     * @param cause could be null
042     */
043    public PluginMetadataParseException( File metadataFile, String message, Throwable cause )
044    {
045        super( "Error parsing file: " + metadataFile + ". Reason: " + message, cause );
046
047        this.metadataFile = metadataFile;
048        this.originalMessage = message;
049    }
050
051    /**
052     * @param metadataFile could be null
053     * @param message could be null
054     */
055    public PluginMetadataParseException( File metadataFile, String message )
056    {
057        super( "Error parsing file: " + metadataFile + ". Reason: " + message );
058
059        this.metadataFile = metadataFile;
060        this.originalMessage = message;
061    }
062
063    /**
064     * @return the metadata file
065     */
066    public File getMetadataFile()
067    {
068        return metadataFile;
069    }
070
071    /**
072     * @return the original message
073     */
074    public String getOriginalMessage()
075    {
076        return originalMessage;
077    }
078}