author | joehw |
Mon, 22 Feb 2016 11:00:06 -0800 | |
changeset 36146 | eca249f3c768 |
child 40223 | 64662417aa2d |
permissions | -rw-r--r-- |
36146
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
1 |
/* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
4 |
* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
8 |
* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
13 |
* accompanied this code). |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
14 |
* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
18 |
* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
21 |
* questions. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
22 |
*/ |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
23 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
24 |
package validation; |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
25 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
26 |
import java.io.File; |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
27 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
28 |
import javax.xml.XMLConstants; |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
29 |
import javax.xml.validation.SchemaFactory; |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
30 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
31 |
import org.testng.annotations.Test; |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
32 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
33 |
/* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
34 |
* @summary Test Schema creation |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
35 |
* @bug 8149915 |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
36 |
*/ |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
37 |
public class SchemaTest { |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
38 |
|
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
39 |
/* |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
40 |
* @bug 8149915 |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
41 |
* Verifies that the annotation validator is initialized with the security manager for schema |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
42 |
* creation with http://apache.org/xml/features/validate-annotations=true. |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
43 |
*/ |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
44 |
@Test |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
45 |
public void testValidation() throws Exception { |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
46 |
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
47 |
factory.setFeature("http://apache.org/xml/features/validate-annotations", true); |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
48 |
factory.newSchema(new File(getClass().getResource("Bug8149915.xsd").getFile())); |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
49 |
} |
eca249f3c768
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
joehw
parents:
diff
changeset
|
50 |
} |