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    
034        private static final long serialVersionUID = 4630222650675402789L;
035    
036        public DocumentParseException(String message)
037        {
038            this(message, (Resource) null);
039        }
040    
041        public DocumentParseException(String message, Throwable rootCause)
042        {
043            super(message, null, rootCause);
044        }
045    
046        public DocumentParseException(String message, Location location)
047        {
048            super(message, location, null);
049        }
050    
051        public DocumentParseException(String message, Location location,
052                Throwable rootCause)
053        {
054            super(message, location, rootCause);
055        }
056    
057        public DocumentParseException(String message, Resource resource,
058                SAXParseException rootCause)
059        {
060            this(message, resource == null ? null : new LocationImpl(resource,
061                    rootCause.getLineNumber(), rootCause.getColumnNumber()),
062                    rootCause);
063        }
064    
065        public DocumentParseException(String message, Resource resource)
066        {
067            this(message, resource, (Throwable) null);
068        }
069    
070        public DocumentParseException(String message, Resource resource,
071                Throwable rootCause)
072        {
073            this(message, resource == null ? null : new LocationImpl(resource),
074                    rootCause);
075        }
076    }