001    package org.apache.maven.plugin.tools.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    
022    import java.io.File;
023    
024    /**
025     * Exception when plugin metadata parsing occurred.
026     *
027     * @version $Id: PluginMetadataParseException.java 684241 2008-08-09 12:16:04Z vsiveton $
028     */
029    public class PluginMetadataParseException
030        extends Exception
031    {
032        /** serialVersionUID */
033        static final long serialVersionUID = 4022348153707995574L;
034    
035        private final File metadataFile;
036    
037        private final String originalMessage;
038    
039        /**
040         * @param metadataFile could be null
041         * @param message could be null
042         * @param cause could be null
043         */
044        public PluginMetadataParseException( File metadataFile, String message, Throwable cause )
045        {
046            super( "Error parsing file: " + metadataFile + ". Reason: " + message, cause );
047    
048            this.metadataFile = metadataFile;
049            this.originalMessage = message;
050        }
051    
052        /**
053         * @param metadataFile could be null
054         * @param message could be null
055         */
056        public PluginMetadataParseException( File metadataFile, String message )
057        {
058            super( "Error parsing file: " + metadataFile + ". Reason: " + message );
059    
060            this.metadataFile = metadataFile;
061            this.originalMessage = message;
062        }
063    
064        /**
065         * @return the metadata file
066         */
067        public File getMetadataFile()
068        {
069            return metadataFile;
070        }
071    
072        /**
073         * @return the original message
074         */
075        public String getOriginalMessage()
076        {
077            return originalMessage;
078        }
079    }