jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/parser/JAXPParser.java
author mkos
Fri, 23 Aug 2013 09:57:21 +0100
changeset 19645 36f707905f2b
parent 12009 4abb694f273a
permissions -rw-r--r--
8022885: Update JAX-WS RI integration to 2.2.9-b14140 8013016: Rebase 8009009 against the latest jdk8/jaxws Reviewed-by: alanb, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     1
/*
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     4
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    10
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    15
 * accompanied this code).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    16
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    20
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    23
 * questions.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    24
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    25
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    26
package com.sun.xml.internal.xsom.parser;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    27
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    28
import java.io.IOException;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    29
import java.net.URL;
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    30
import java.util.logging.Level;
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    31
import java.util.logging.Logger;
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    32
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    33
import javax.xml.parsers.ParserConfigurationException;
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    34
import javax.xml.parsers.SAXParser;
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    35
import javax.xml.parsers.SAXParserFactory;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    36
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    37
import org.xml.sax.*;
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    38
import org.xml.sax.helpers.XMLFilterImpl;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    39
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    40
import com.sun.xml.internal.xsom.impl.parser.Messages;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    41
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    42
/**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    43
 * Standard XMLParser implemented by using JAXP.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    44
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    45
 * @author
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    46
 *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    47
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    48
public class JAXPParser implements XMLParser {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    49
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    50
    // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    51
    private static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    52
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    53
    private static final Logger LOGGER = Logger.getLogger(JAXPParser.class.getName());
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    54
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    55
    private final SAXParserFactory factory;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    56
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    57
    public JAXPParser( SAXParserFactory factory ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    58
        factory.setNamespaceAware(true);    // just in case
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    59
        this.factory = factory;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    60
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    61
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    62
    /**
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    63
     * @deprecated Unsafe, use JAXPParser(factory) instead with
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    64
     * security features initialized by setting
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    65
     * XMLConstants.FEATURE_SECURE_PROCESSING feature.
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    66
     */
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    67
    public JAXPParser() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    68
        this( SAXParserFactory.newInstance());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    69
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    70
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    71
    public void parse( InputSource source, ContentHandler handler,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    72
        ErrorHandler errorHandler, EntityResolver entityResolver )
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    73
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    74
        throws SAXException, IOException {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    75
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    76
        try {
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    77
            SAXParser saxParser = allowFileAccess(factory.newSAXParser(), false);
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    78
            XMLReader reader = new XMLReaderEx(saxParser.getXMLReader());
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    79
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    80
            reader.setContentHandler(handler);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    81
            if(errorHandler!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    82
                reader.setErrorHandler(errorHandler);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    83
            if(entityResolver!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    84
                reader.setEntityResolver(entityResolver);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    85
            reader.parse(source);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    86
        } catch( ParserConfigurationException e ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    87
            // in practice this won't happen
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    88
            SAXParseException spe = new SAXParseException(e.getMessage(),null,e);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    89
            errorHandler.fatalError(spe);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    90
            throw spe;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    91
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    92
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    93
19645
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    94
    private static SAXParser allowFileAccess(SAXParser saxParser, boolean disableSecureProcessing) throws SAXException {
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    95
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    96
        // if feature secure processing enabled, nothing to do, file is allowed,
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    97
        // or user is able to control access by standard JAXP mechanisms
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    98
        if (disableSecureProcessing) {
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
    99
            return saxParser;
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   100
        }
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   101
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   102
        try {
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   103
            saxParser.setProperty(ACCESS_EXTERNAL_SCHEMA, "file");
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   104
            LOGGER.log(Level.FINE, Messages.format(Messages.JAXP_SUPPORTED_PROPERTY, ACCESS_EXTERNAL_SCHEMA));
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   105
        } catch (SAXException ignored) {
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   106
            // nothing to do; support depends on version JDK or SAX implementation
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   107
            LOGGER.log(Level.CONFIG, Messages.format(Messages.JAXP_UNSUPPORTED_PROPERTY, ACCESS_EXTERNAL_SCHEMA), ignored);
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   108
        }
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   109
        return saxParser;
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   110
    }
36f707905f2b 8022885: Update JAX-WS RI integration to 2.2.9-b14140
mkos
parents: 12009
diff changeset
   111
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   112
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   113
     * XMLReader with improved error message for entity resolution failure.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   114
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   115
     * TODO: this class is completely stand-alone, so it shouldn't be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   116
     * an inner class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   117
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   118
    private static class XMLReaderEx extends XMLFilterImpl {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   119
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   120
        private Locator locator;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   121
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   122
        XMLReaderEx( XMLReader parent ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   123
            this.setParent(parent);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   124
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   125
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   126
        /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   127
         * Resolves entities and reports user-friendly error messages.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   128
         *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   129
         * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   130
         * Some XML parser (at least Xerces) does not report much information
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   131
         * when it fails to resolve an entity, which is often quite
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   132
         * frustrating. For example, if you are behind a firewall and the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   133
         * schema contains a reference to www.w3.org, and there is no
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   134
         * entity resolver, the parser will just throw an IOException
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   135
         * that doesn't contain any information about where that reference
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   136
         * occurs nor what it is accessing.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   137
         *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   138
         * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   139
         * By implementing an EntityResolver and resolving the reference
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   140
         * by ourselves, we can report an error message with all the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   141
         * necessary information to fix the problem.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   142
         *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   143
         * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   144
         * Note that we still need to the client-specified entity resolver
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   145
         * to let the application handle entity resolution. Here we just catch
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   146
         * an IOException and add more information.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   147
         */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   148
        @Override
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   149
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   150
            try {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   151
                InputSource is=null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   152
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   153
                // ask the client-specified entity resolver first
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   154
                if( this.getEntityResolver()!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   155
                    is = this.getEntityResolver().resolveEntity(publicId,systemId);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   156
                if( is!=null )  return is;  // if that succeeds, fine.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   157
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   158
                // rather than returning null, resolve it now
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   159
                // so that we can detect errors.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   160
                is = new InputSource( new URL(systemId).openStream() );
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   161
                is.setSystemId(systemId);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   162
                is.setPublicId(publicId);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   163
                return is;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   164
            } catch( IOException e ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   165
                // catch this error and provide a nice error message, rather than
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   166
                // just throwing this IOException.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   167
                SAXParseException spe = new SAXParseException(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   168
                    Messages.format(Messages.ERR_ENTITY_RESOLUTION_FAILURE,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   169
                        systemId, e.toString()),    // use the toString method to get the class name
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   170
                    locator, e );
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   171
                if(this.getErrorHandler()!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   172
                    this.getErrorHandler().fatalError(spe);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   173
                throw spe;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   174
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   175
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   176
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   177
        @Override
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   178
        public void setDocumentLocator(Locator locator) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   179
            super.setDocumentLocator(locator);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   180
            this.locator = locator;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   181
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   182
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   183
}