src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 397
b99d7e355d4b
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, 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
29 29
30 import javax.xml.validation.Schema; 30 import javax.xml.validation.Schema;
31 import javax.xml.validation.SchemaFactory; 31 import javax.xml.validation.SchemaFactory;
32 import javax.xml.validation.ValidatorHandler; 32 import javax.xml.validation.ValidatorHandler;
33 33
34 import com.sun.xml.internal.bind.v2.WellKnownNamespace; 34 import com.sun.xml.internal.bind.v2.util.XmlFactory;
35 35 import javax.xml.XMLConstants;
36 import org.xml.sax.SAXException; 36 import org.xml.sax.SAXException;
37 37
38 /** 38 /**
39 * Wraps a JAXP {@link Schema} object and lazily instantiate it. 39 * Wraps a JAXP {@link Schema} object and lazily instantiate it.
40 * 40 *
55 55
56 public ValidatorHandler newValidator() { 56 public ValidatorHandler newValidator() {
57 synchronized(this) { 57 synchronized(this) {
58 if(schema==null) { 58 if(schema==null) {
59 try { 59 try {
60 schema = SchemaFactory.newInstance(WellKnownNamespace.XML_SCHEMA).newSchema(source); 60 // do not disable secure processing - these are well-known schemas
61 SchemaFactory sf = XmlFactory.createSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI, false);
62 schema = sf.newSchema(source);
61 } catch (SAXException e) { 63 } catch (SAXException e) {
62 // we make sure that the schema is correct before we ship. 64 // we make sure that the schema is correct before we ship.
63 throw new AssertionError(e); 65 throw new AssertionError(e);
64 } 66 }
65 } 67 }

mercurial