001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.util.xml;
016    
017    import org.apache.hivemind.ApplicationRuntimeException;
018    import org.apache.hivemind.Location;
019    import org.apache.hivemind.Resource;
020    import org.apache.hivemind.impl.LocationImpl;
021    import org.xml.sax.SAXParseException;
022    
023    /**
024     * Exception thrown if there is any kind of error parsing the an XML document.
025     * 
026     * @see org.apache.tapestry.parse.SpecificationParser
027     * @author Howard Lewis Ship
028     * @since 0.2.10
029     */
030    
031    public class DocumentParseException extends ApplicationRuntimeException
032    {
033        private static final long serialVersionUID = 4630222650675402789L;
034    
035            public DocumentParseException(String message)
036        {
037            this(message, (Resource) null);
038        }
039    
040        public DocumentParseException(String message, Throwable rootCause)
041        {
042            super(message, null, rootCause);
043        }
044    
045        public DocumentParseException(String message, Location location)
046        {
047            super(message, location, null);
048        }
049    
050        public DocumentParseException(String message, Location location, Throwable rootCause)
051        {
052            super(message, location, rootCause);
053        }
054    
055        public DocumentParseException(String message, Resource resource, SAXParseException rootCause)
056        {
057            this(message, resource == null ? null : new LocationImpl(resource, rootCause
058                    .getLineNumber(), rootCause.getColumnNumber()), rootCause);
059        }
060    
061        public DocumentParseException(String message, Resource resource)
062        {
063            this(message, resource, (Throwable) null);
064        }
065    
066        public DocumentParseException(String message, Resource resource, Throwable rootCause)
067        {
068            this(message, resource == null ? null : new LocationImpl(resource), rootCause);
069        }
070    }