jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java
changeset 19645 36f707905f2b
parent 16791 fe5141eabb0e
child 20590 b3b34e4344ce
equal deleted inserted replaced
19257:30a1d677a20c 19645:36f707905f2b
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    33 
    33 
    34 import com.sun.xml.internal.bind.v2.util.XmlFactory;
    34 import com.sun.xml.internal.bind.v2.util.XmlFactory;
    35 import javax.xml.XMLConstants;
    35 import javax.xml.XMLConstants;
    36 import org.xml.sax.SAXException;
    36 import org.xml.sax.SAXException;
    37 
    37 
       
    38 import static com.sun.xml.internal.bind.v2.util.XmlFactory.allowFileAccess;
       
    39 
    38 /**
    40 /**
    39  * Wraps a JAXP {@link Schema} object and lazily instantiate it.
    41  * Wraps a JAXP {@link Schema} object and lazily instantiate it.
    40  *
    42  *
    41  * This object is thread-safe. There should be only one instance of
    43  * This object is thread-safe. There should be only one instance of
    42  * this for the whole VM.
    44  * this for the whole VM.
    57         synchronized(this) {
    59         synchronized(this) {
    58             if(schema==null) {
    60             if(schema==null) {
    59                 try {
    61                 try {
    60                     // do not disable secure processing - these are well-known schemas
    62                     // do not disable secure processing - these are well-known schemas
    61                     SchemaFactory sf = XmlFactory.createSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI, false);
    63                     SchemaFactory sf = XmlFactory.createSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI, false);
    62                     schema = sf.newSchema(source);
    64                     schema = allowFileAccess(sf, false).newSchema(source);
    63                 } catch (SAXException e) {
    65                 } catch (SAXException e) {
    64                     // we make sure that the schema is correct before we ship.
    66                     // we make sure that the schema is correct before we ship.
    65                     throw new AssertionError(e);
    67                     throw new AssertionError(e);
    66                 }
    68                 }
    67             }
    69             }