src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 515
6cd506508147
parent 0
373ffda63c9a
child 760
e530533619ec
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.xml.internal.ws.util.xml;
aoqi@0 27
aoqi@0 28 import com.sun.istack.internal.Nullable;
aoqi@0 29 import com.sun.org.apache.xml.internal.resolver.Catalog;
aoqi@0 30 import com.sun.org.apache.xml.internal.resolver.CatalogManager;
aoqi@0 31 import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver;
aoqi@0 32 import com.sun.xml.internal.ws.server.ServerRtException;
aoqi@0 33 import com.sun.xml.internal.ws.util.ByteArrayBuffer;
aoqi@0 34 import org.w3c.dom.Attr;
aoqi@0 35 import org.w3c.dom.Element;
aoqi@0 36 import org.w3c.dom.EntityReference;
aoqi@0 37 import org.w3c.dom.Node;
aoqi@0 38 import org.w3c.dom.NodeList;
aoqi@0 39 import org.w3c.dom.Text;
aoqi@0 40 import org.xml.sax.*;
aoqi@0 41
aoqi@0 42 import javax.xml.XMLConstants;
aoqi@0 43 import javax.xml.namespace.QName;
aoqi@0 44 import javax.xml.parsers.DocumentBuilderFactory;
aoqi@0 45 import javax.xml.parsers.ParserConfigurationException;
aoqi@0 46 import javax.xml.parsers.SAXParserFactory;
aoqi@0 47 import javax.xml.stream.XMLInputFactory;
aoqi@0 48 import javax.xml.transform.Result;
aoqi@0 49 import javax.xml.transform.Source;
aoqi@0 50 import javax.xml.transform.Transformer;
aoqi@0 51 import javax.xml.transform.TransformerConfigurationException;
aoqi@0 52 import javax.xml.transform.TransformerException;
aoqi@0 53 import javax.xml.transform.TransformerFactory;
aoqi@0 54 import javax.xml.transform.sax.SAXTransformerFactory;
aoqi@0 55 import javax.xml.transform.sax.TransformerHandler;
aoqi@0 56 import javax.xml.transform.stream.StreamSource;
aoqi@0 57 import javax.xml.validation.SchemaFactory;
aoqi@0 58 import javax.xml.ws.WebServiceException;
aoqi@0 59 import javax.xml.xpath.XPathFactory;
aoqi@0 60 import javax.xml.xpath.XPathFactoryConfigurationException;
aoqi@0 61 import java.io.IOException;
aoqi@0 62 import java.io.InputStream;
aoqi@0 63 import java.io.OutputStreamWriter;
aoqi@0 64 import java.io.Writer;
aoqi@0 65 import java.net.URL;
aoqi@0 66 import java.util.ArrayList;
aoqi@0 67 import java.util.Enumeration;
aoqi@0 68 import java.util.Iterator;
aoqi@0 69 import java.util.List;
aoqi@0 70 import java.util.StringTokenizer;
aoqi@0 71 import java.util.logging.Level;
aoqi@0 72 import java.util.logging.Logger;
aoqi@0 73
aoqi@0 74 /**
aoqi@0 75 * @author WS Development Team
aoqi@0 76 */
aoqi@0 77 public class XmlUtil {
aoqi@0 78
aoqi@0 79 // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used
aoqi@0 80 private static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";
aoqi@0 81
aoqi@0 82 private final static String LEXICAL_HANDLER_PROPERTY =
aoqi@0 83 "http://xml.org/sax/properties/lexical-handler";
aoqi@0 84
aoqi@0 85 private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName());
aoqi@0 86
aoqi@0 87 private static boolean XML_SECURITY_DISABLED;
aoqi@0 88
aoqi@0 89 static {
aoqi@0 90 String disableXmlSecurity = System.getProperty("com.sun.xml.internal.ws.disableXmlSecurity");
aoqi@0 91 XML_SECURITY_DISABLED = disableXmlSecurity == null || !Boolean.valueOf(disableXmlSecurity);
aoqi@0 92 }
aoqi@0 93
aoqi@0 94 public static String getPrefix(String s) {
aoqi@0 95 int i = s.indexOf(':');
aoqi@0 96 if (i == -1)
aoqi@0 97 return null;
aoqi@0 98 return s.substring(0, i);
aoqi@0 99 }
aoqi@0 100
aoqi@0 101 public static String getLocalPart(String s) {
aoqi@0 102 int i = s.indexOf(':');
aoqi@0 103 if (i == -1)
aoqi@0 104 return s;
aoqi@0 105 return s.substring(i + 1);
aoqi@0 106 }
aoqi@0 107
aoqi@0 108
aoqi@0 109
aoqi@0 110 public static String getAttributeOrNull(Element e, String name) {
aoqi@0 111 Attr a = e.getAttributeNode(name);
aoqi@0 112 if (a == null)
aoqi@0 113 return null;
aoqi@0 114 return a.getValue();
aoqi@0 115 }
aoqi@0 116
aoqi@0 117 public static String getAttributeNSOrNull(
aoqi@0 118 Element e,
aoqi@0 119 String name,
aoqi@0 120 String nsURI) {
aoqi@0 121 Attr a = e.getAttributeNodeNS(nsURI, name);
aoqi@0 122 if (a == null)
aoqi@0 123 return null;
aoqi@0 124 return a.getValue();
aoqi@0 125 }
aoqi@0 126
aoqi@0 127 public static String getAttributeNSOrNull(
aoqi@0 128 Element e,
aoqi@0 129 QName name) {
aoqi@0 130 Attr a = e.getAttributeNodeNS(name.getNamespaceURI(), name.getLocalPart());
aoqi@0 131 if (a == null)
aoqi@0 132 return null;
aoqi@0 133 return a.getValue();
aoqi@0 134 }
aoqi@0 135
aoqi@0 136 /* public static boolean matchesTagNS(Element e, String tag, String nsURI) {
aoqi@0 137 try {
aoqi@0 138 return e.getLocalName().equals(tag)
aoqi@0 139 && e.getNamespaceURI().equals(nsURI);
aoqi@0 140 } catch (NullPointerException npe) {
aoqi@0 141
aoqi@0 142 // localname not null since parsing would fail before here
aoqi@0 143 throw new WSDLParseException(
aoqi@0 144 "null.namespace.found",
aoqi@0 145 e.getLocalName());
aoqi@0 146 }
aoqi@0 147 }
aoqi@0 148
aoqi@0 149 public static boolean matchesTagNS(
aoqi@0 150 Element e,
aoqi@0 151 javax.xml.namespace.QName name) {
aoqi@0 152 try {
aoqi@0 153 return e.getLocalName().equals(name.getLocalPart())
aoqi@0 154 && e.getNamespaceURI().equals(name.getNamespaceURI());
aoqi@0 155 } catch (NullPointerException npe) {
aoqi@0 156
aoqi@0 157 // localname not null since parsing would fail before here
aoqi@0 158 throw new WSDLParseException(
aoqi@0 159 "null.namespace.found",
aoqi@0 160 e.getLocalName());
aoqi@0 161 }
aoqi@0 162 }*/
aoqi@0 163
aoqi@0 164 public static Iterator getAllChildren(Element element) {
aoqi@0 165 return new NodeListIterator(element.getChildNodes());
aoqi@0 166 }
aoqi@0 167
aoqi@0 168 public static Iterator getAllAttributes(Element element) {
aoqi@0 169 return new NamedNodeMapIterator(element.getAttributes());
aoqi@0 170 }
aoqi@0 171
aoqi@0 172 public static List<String> parseTokenList(String tokenList) {
aoqi@0 173 List<String> result = new ArrayList<String>();
aoqi@0 174 StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
aoqi@0 175 while (tokenizer.hasMoreTokens()) {
aoqi@0 176 result.add(tokenizer.nextToken());
aoqi@0 177 }
aoqi@0 178 return result;
aoqi@0 179 }
aoqi@0 180
aoqi@0 181 public static String getTextForNode(Node node) {
aoqi@0 182 StringBuilder sb = new StringBuilder();
aoqi@0 183
aoqi@0 184 NodeList children = node.getChildNodes();
aoqi@0 185 if (children.getLength() == 0)
aoqi@0 186 return null;
aoqi@0 187
aoqi@0 188 for (int i = 0; i < children.getLength(); ++i) {
aoqi@0 189 Node n = children.item(i);
aoqi@0 190
aoqi@0 191 if (n instanceof Text)
aoqi@0 192 sb.append(n.getNodeValue());
aoqi@0 193 else if (n instanceof EntityReference) {
aoqi@0 194 String s = getTextForNode(n);
aoqi@0 195 if (s == null)
aoqi@0 196 return null;
aoqi@0 197 else
aoqi@0 198 sb.append(s);
aoqi@0 199 } else
aoqi@0 200 return null;
aoqi@0 201 }
aoqi@0 202
aoqi@0 203 return sb.toString();
aoqi@0 204 }
aoqi@0 205
aoqi@0 206 public static InputStream getUTF8Stream(String s) {
aoqi@0 207 try {
aoqi@0 208 ByteArrayBuffer bab = new ByteArrayBuffer();
aoqi@0 209 Writer w = new OutputStreamWriter(bab, "utf-8");
aoqi@0 210 w.write(s);
aoqi@0 211 w.close();
aoqi@0 212 return bab.newInputStream();
aoqi@0 213 } catch (IOException e) {
aoqi@0 214 throw new RuntimeException("should not happen");
aoqi@0 215 }
aoqi@0 216 }
aoqi@0 217
aoqi@0 218 static final ContextClassloaderLocal<TransformerFactory> transformerFactory = new ContextClassloaderLocal<TransformerFactory>() {
aoqi@0 219 @Override
aoqi@0 220 protected TransformerFactory initialValue() throws Exception {
aoqi@0 221 return TransformerFactory.newInstance();
aoqi@0 222 }
aoqi@0 223 };
aoqi@0 224
aoqi@0 225 static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() {
aoqi@0 226 @Override
aoqi@0 227 protected SAXParserFactory initialValue() throws Exception {
aoqi@0 228 SAXParserFactory factory = SAXParserFactory.newInstance();
aoqi@0 229 factory.setNamespaceAware(true);
aoqi@0 230 return factory;
aoqi@0 231 }
aoqi@0 232 };
aoqi@0 233
aoqi@0 234 /**
aoqi@0 235 * Creates a new identity transformer.
aoqi@0 236 */
aoqi@0 237 public static Transformer newTransformer() {
aoqi@0 238 try {
aoqi@0 239 return transformerFactory.get().newTransformer();
aoqi@0 240 } catch (TransformerConfigurationException tex) {
aoqi@0 241 throw new IllegalStateException("Unable to create a JAXP transformer");
aoqi@0 242 }
aoqi@0 243 }
aoqi@0 244
aoqi@0 245 /**
aoqi@0 246 * Performs identity transformation.
aoqi@0 247 */
aoqi@0 248 public static <T extends Result>
aoqi@0 249 T identityTransform(Source src, T result) throws TransformerException, SAXException, ParserConfigurationException, IOException {
aoqi@0 250 if (src instanceof StreamSource) {
aoqi@0 251 // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing
aoqi@0 252 // is not turned on by default
aoqi@0 253 StreamSource ssrc = (StreamSource) src;
aoqi@0 254 TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler();
aoqi@0 255 th.setResult(result);
aoqi@0 256 XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader();
aoqi@0 257 reader.setContentHandler(th);
aoqi@0 258 reader.setProperty(LEXICAL_HANDLER_PROPERTY, th);
aoqi@0 259 reader.parse(toInputSource(ssrc));
aoqi@0 260 } else {
aoqi@0 261 newTransformer().transform(src, result);
aoqi@0 262 }
aoqi@0 263 return result;
aoqi@0 264 }
aoqi@0 265
aoqi@0 266 private static InputSource toInputSource(StreamSource src) {
aoqi@0 267 InputSource is = new InputSource();
aoqi@0 268 is.setByteStream(src.getInputStream());
aoqi@0 269 is.setCharacterStream(src.getReader());
aoqi@0 270 is.setPublicId(src.getPublicId());
aoqi@0 271 is.setSystemId(src.getSystemId());
aoqi@0 272 return is;
aoqi@0 273 }
aoqi@0 274
aoqi@0 275 /*
aoqi@0 276 * Gets an EntityResolver using XML catalog
aoqi@0 277 */
aoqi@0 278 public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
aoqi@0 279 // set up a manager
aoqi@0 280 CatalogManager manager = new CatalogManager();
aoqi@0 281 manager.setIgnoreMissingProperties(true);
aoqi@0 282 // Using static catalog may result in to sharing of the catalog by multiple apps running in a container
aoqi@0 283 manager.setUseStaticCatalog(false);
aoqi@0 284 Catalog catalog = manager.getCatalog();
aoqi@0 285 try {
aoqi@0 286 if (catalogUrl != null) {
aoqi@0 287 catalog.parseCatalog(catalogUrl);
aoqi@0 288 }
aoqi@0 289 } catch (IOException e) {
aoqi@0 290 throw new ServerRtException("server.rt.err",e);
aoqi@0 291 }
aoqi@0 292 return workaroundCatalogResolver(catalog);
aoqi@0 293 }
aoqi@0 294
aoqi@0 295 /**
aoqi@0 296 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
aoqi@0 297 */
aoqi@0 298 public static EntityResolver createDefaultCatalogResolver() {
aoqi@0 299
aoqi@0 300 // set up a manager
aoqi@0 301 CatalogManager manager = new CatalogManager();
aoqi@0 302 manager.setIgnoreMissingProperties(true);
aoqi@0 303 // Using static catalog may result in to sharing of the catalog by multiple apps running in a container
aoqi@0 304 manager.setUseStaticCatalog(false);
aoqi@0 305 // parse the catalog
aoqi@0 306 ClassLoader cl = Thread.currentThread().getContextClassLoader();
aoqi@0 307 Enumeration<URL> catalogEnum;
aoqi@0 308 Catalog catalog = manager.getCatalog();
aoqi@0 309 try {
aoqi@0 310 if (cl == null) {
aoqi@0 311 catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
aoqi@0 312 } else {
aoqi@0 313 catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
aoqi@0 314 }
aoqi@0 315
aoqi@0 316 while(catalogEnum.hasMoreElements()) {
aoqi@0 317 URL url = catalogEnum.nextElement();
aoqi@0 318 catalog.parseCatalog(url);
aoqi@0 319 }
aoqi@0 320 } catch (IOException e) {
aoqi@0 321 throw new WebServiceException(e);
aoqi@0 322 }
aoqi@0 323
aoqi@0 324 return workaroundCatalogResolver(catalog);
aoqi@0 325 }
aoqi@0 326
aoqi@0 327 /**
aoqi@0 328 * Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
aoqi@0 329 * useStaticCatalog is false.
aoqi@0 330 * This returns a CatalogResolver that uses the catalog passed as parameter.
aoqi@0 331 * @param catalog
aoqi@0 332 * @return CatalogResolver
aoqi@0 333 */
aoqi@0 334 private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
aoqi@0 335 // set up a manager
aoqi@0 336 CatalogManager manager = new CatalogManager() {
aoqi@0 337 @Override
aoqi@0 338 public Catalog getCatalog() {
aoqi@0 339 return catalog;
aoqi@0 340 }
aoqi@0 341 };
aoqi@0 342 manager.setIgnoreMissingProperties(true);
aoqi@0 343 // Using static catalog may result in to sharing of the catalog by multiple apps running in a container
aoqi@0 344 manager.setUseStaticCatalog(false);
aoqi@0 345
aoqi@0 346 return new CatalogResolver(manager);
aoqi@0 347 }
aoqi@0 348
aoqi@0 349 /**
aoqi@0 350 * {@link ErrorHandler} that always treat the error as fatal.
aoqi@0 351 */
aoqi@0 352 public static final ErrorHandler DRACONIAN_ERROR_HANDLER = new ErrorHandler() {
aoqi@0 353 @Override
aoqi@0 354 public void warning(SAXParseException exception) {
aoqi@0 355 }
aoqi@0 356
aoqi@0 357 @Override
aoqi@0 358 public void error(SAXParseException exception) throws SAXException {
aoqi@0 359 throw exception;
aoqi@0 360 }
aoqi@0 361
aoqi@0 362 @Override
aoqi@0 363 public void fatalError(SAXParseException exception) throws SAXException {
aoqi@0 364 throw exception;
aoqi@0 365 }
aoqi@0 366 };
aoqi@0 367
aoqi@0 368 public static DocumentBuilderFactory newDocumentBuilderFactory() {
aoqi@0 369 return newDocumentBuilderFactory(true);
aoqi@0 370 }
aoqi@0 371
aoqi@0 372 public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) {
aoqi@0 373 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
aoqi@0 374 try {
aoqi@0 375 factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing));
aoqi@0 376 } catch (ParserConfigurationException e) {
aoqi@0 377 LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
aoqi@0 378 }
aoqi@0 379 return factory;
aoqi@0 380 }
aoqi@0 381
aoqi@0 382 public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) {
aoqi@0 383 TransformerFactory factory = TransformerFactory.newInstance();
aoqi@0 384 try {
aoqi@0 385 factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
aoqi@0 386 } catch (TransformerConfigurationException e) {
aoqi@0 387 LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
aoqi@0 388 }
aoqi@0 389 return factory;
aoqi@0 390 }
aoqi@0 391
aoqi@0 392 public static TransformerFactory newTransformerFactory() {
aoqi@0 393 return newTransformerFactory(true);
aoqi@0 394 }
aoqi@0 395
aoqi@0 396 public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) {
aoqi@0 397 SAXParserFactory factory = SAXParserFactory.newInstance();
aoqi@0 398 try {
aoqi@0 399 factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
aoqi@0 400 } catch (Exception e) {
aoqi@0 401 LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
aoqi@0 402 }
aoqi@0 403 return factory;
aoqi@0 404 }
aoqi@0 405
aoqi@0 406 public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) {
aoqi@0 407 XPathFactory factory = XPathFactory.newInstance();
aoqi@0 408 try {
aoqi@0 409 factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
aoqi@0 410 } catch (XPathFactoryConfigurationException e) {
aoqi@0 411 LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
aoqi@0 412 }
aoqi@0 413 return factory;
aoqi@0 414 }
aoqi@0 415
aoqi@0 416 public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled) {
aoqi@0 417 XMLInputFactory factory = XMLInputFactory.newInstance();
aoqi@0 418 if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) {
aoqi@0 419 // TODO-Miran: are those apppropriate defaults?
aoqi@0 420 factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
aoqi@0 421 factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
aoqi@0 422 }
aoqi@0 423 return factory;
aoqi@0 424 }
aoqi@0 425
aoqi@0 426 private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) {
aoqi@0 427 return XML_SECURITY_DISABLED || runtimeDisabled;
aoqi@0 428 }
aoqi@0 429
aoqi@0 430 public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) {
aoqi@0 431
aoqi@0 432 // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
aoqi@0 433 if (isXMLSecurityDisabled(disableSecureProcessing)) {
aoqi@0 434 if (LOGGER.isLoggable(Level.FINE)) {
aoqi@0 435 LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
aoqi@0 436 }
aoqi@0 437 return sf;
aoqi@0 438 }
aoqi@0 439
aoqi@0 440 if (System.getProperty("javax.xml.accessExternalSchema") != null) {
aoqi@0 441 if (LOGGER.isLoggable(Level.FINE)) {
aoqi@0 442 LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary.");
aoqi@0 443 }
aoqi@0 444 return sf;
aoqi@0 445 }
aoqi@0 446
aoqi@0 447 try {
aoqi@0 448 sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
aoqi@0 449 if (LOGGER.isLoggable(Level.FINE)) {
aoqi@0 450 LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
aoqi@0 451 }
aoqi@0 452 } catch (SAXException ignored) {
aoqi@0 453 // nothing to do; support depends on version JDK or SAX implementation
aoqi@0 454 if (LOGGER.isLoggable(Level.CONFIG)) {
aoqi@0 455 LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
aoqi@0 456 }
aoqi@0 457 }
aoqi@0 458 return sf;
aoqi@0 459 }
aoqi@0 460
aoqi@0 461 }

mercurial