Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c647758c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c647758c
编写于
10月 02, 2017
作者:
A
aefimov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8159240: XSOM parser incorrectly processes type names with whitespaces
Reviewed-by: coffeys
上级
b5d84e6a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
341 addition
and
0 deletion
+341
-0
test/javax/xml/bind/xsom/8159240/WhitespacesTest.java
test/javax/xml/bind/xsom/8159240/WhitespacesTest.java
+103
-0
test/javax/xml/bind/xsom/8159240/complexType.xsd
test/javax/xml/bind/xsom/8159240/complexType.xsd
+23
-0
test/javax/xml/bind/xsom/8159240/complexTypeExtension.xsd
test/javax/xml/bind/xsom/8159240/complexTypeExtension.xsd
+49
-0
test/javax/xml/bind/xsom/8159240/complexTypeRestriction.xsd
test/javax/xml/bind/xsom/8159240/complexTypeRestriction.xsd
+48
-0
test/javax/xml/bind/xsom/8159240/identityConstraint.xsd
test/javax/xml/bind/xsom/8159240/identityConstraint.xsd
+24
-0
test/javax/xml/bind/xsom/8159240/particlesAndAttributes.xsd
test/javax/xml/bind/xsom/8159240/particlesAndAttributes.xsd
+63
-0
test/javax/xml/bind/xsom/8159240/simpleType.xsd
test/javax/xml/bind/xsom/8159240/simpleType.xsd
+31
-0
未找到文件。
test/javax/xml/bind/xsom/8159240/WhitespacesTest.java
0 → 100644
浏览文件 @
c647758c
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8159240
* @summary Check if types and names with whitespaces are collapsed by
* XSOM schema parser
* @compile -XDignore.symbol.file WhitespacesTest.java
* @run testng WhitespacesTest
*
*/
import
com.sun.xml.internal.xsom.parser.XSOMParser
;
import
java.io.File
;
import
java.nio.file.Paths
;
import
javax.xml.parsers.SAXParserFactory
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
org.xml.sax.ErrorHandler
;
import
org.xml.sax.SAXException
;
import
org.xml.sax.SAXParseException
;
public
class
WhitespacesTest
{
@Test
(
dataProvider
=
"TestSchemaFiles"
)
public
void
testWhitespacesCollapse
(
String
schemaFile
)
throws
Exception
{
XSOMParser
parser
=
new
XSOMParser
(
SAXParserFactory
.
newInstance
());
XsomErrorHandler
eh
=
new
XsomErrorHandler
();
parser
.
setErrorHandler
(
eh
);
parser
.
parse
(
getSchemaFile
(
schemaFile
));
if
(
eh
.
gotError
)
{
throw
new
RuntimeException
(
"XSOM parser encountered error"
,
eh
.
e
);
}
}
// Get location of schema file located in test source directory
private
static
File
getSchemaFile
(
String
filename
)
{
String
testSrc
=
System
.
getProperty
(
"test.src"
,
"."
);
return
Paths
.
get
(
testSrc
).
resolve
(
filename
).
toFile
();
}
@DataProvider
(
name
=
"TestSchemaFiles"
)
private
Object
[][]
dataTestSchemaFiles
()
{
return
new
Object
[][]
{
{
"complexType.xsd"
},
{
"complexTypeExtension.xsd"
},
{
"complexTypeRestriction.xsd"
},
{
"identityConstraint.xsd"
},
{
"particlesAndAttributes.xsd"
},
{
"simpleType.xsd"
}
};
}
// Test XSOM error handler
private
static
class
XsomErrorHandler
implements
ErrorHandler
{
public
boolean
gotError
=
false
;
public
Exception
e
=
null
;
@Override
public
void
warning
(
SAXParseException
ex
)
throws
SAXException
{
System
.
err
.
println
(
"XSOM warning:"
+
ex
);
}
@Override
public
void
error
(
SAXParseException
ex
)
throws
SAXException
{
System
.
err
.
println
(
"XSOM error:"
+
ex
);
e
=
ex
;
gotError
=
true
;
}
@Override
public
void
fatalError
(
SAXParseException
ex
)
throws
SAXException
{
System
.
err
.
println
(
"XSOM fatal error:"
+
ex
);
e
=
ex
;
gotError
=
true
;
}
}
}
test/javax/xml/bind/xsom/8159240/complexType.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<!-- Test for whitespaces in xs:complexType 'name' and xs:element 'type' attribute -->
<xsd:schema
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:hy=
"http://www.test.com/Service/"
targetNamespace=
"http://www.test.com/Service/"
>
<xsd:element
name=
"HelloRequest"
type=
"xsd:string"
/>
<xsd:element
name=
"HelloResponse"
type=
"xsd:string"
/>
<xsd:complexType
name=
" info "
>
<xsd:sequence>
<xsd:element
name=
"firstname"
type=
"xsd:string"
/>
<xsd:element
name=
"lastname"
type=
"xsd:string"
/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType
name=
"usage"
>
<xsd:all>
<xsd:element
name=
"customerCharacteristics"
type=
"
hy:info
"
/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
test/javax/xml/bind/xsom/8159240/complexTypeExtension.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<!-- Test for whitespaces in xs:complexType -> xs:extension 'base' attribute value -->
<xs:simpleType
name=
"size"
>
<xs:restriction
base=
"xs:string"
>
<xs:enumeration
value=
"small"
/>
<xs:enumeration
value=
"medium"
/>
<xs:enumeration
value=
"large"
/>
</xs:restriction>
</xs:simpleType>
<xs:complexType
name=
"jeans"
>
<xs:simpleContent>
<xs:extension
base=
"size"
>
<xs:attribute
name=
"sex"
>
<xs:simpleType>
<xs:restriction
base=
"xs:string"
>
<xs:enumeration
value=
"male"
/>
<xs:enumeration
value=
"female"
/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element
name=
"employee"
type=
" fullpersoninfo "
/>
<xs:complexType
name=
" personinfo "
>
<xs:sequence>
<xs:element
name=
"firstname"
type=
"xs:string"
/>
<xs:element
name=
"lastname"
type=
"xs:string"
/>
</xs:sequence>
</xs:complexType>
<xs:complexType
name=
"fullpersoninfo "
>
<xs:complexContent>
<xs:extension
base=
" personinfo"
>
<xs:sequence>
<xs:element
name=
"address"
type=
"xs:string"
/>
<xs:element
name=
"city"
type=
"xs:string"
/>
<xs:element
name=
"country"
type=
"xs:string"
/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
test/javax/xml/bind/xsom/8159240/complexTypeRestriction.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:hy=
"http://www.test.com/Service/"
targetNamespace=
"http://www.test.com/Service/"
>
<xs:simpleType
name=
" size "
>
<xs:restriction
base=
" xs:string"
>
<xs:enumeration
value=
"small"
/>
<xs:enumeration
value=
"medium"
/>
<xs:enumeration
value=
"large"
/>
</xs:restriction>
</xs:simpleType>
<xs:complexType
name=
"jeans"
>
<xs:simpleContent>
<xs:restriction
base=
" hy:size"
>
<xs:attribute
name=
"sex"
>
<xs:simpleType>
<xs:restriction
base=
" xs:string "
>
<xs:enumeration
value=
"male"
/>
<xs:enumeration
value=
"female"
/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType
name=
"customer "
>
<xs:sequence>
<xs:element
name=
" firstname"
type=
"xs:string"
/>
<xs:element
name=
" lastname "
type=
"xs:string"
/>
<xs:element
name=
" country "
type=
"xs:string"
/>
</xs:sequence>
</xs:complexType>
<xs:complexType
name=
"Norwegian_customer"
>
<xs:complexContent>
<xs:restriction
base=
" hy:customer "
>
<xs:sequence>
<xs:element
name=
" firstname"
type=
" xs:string "
/>
<xs:element
name=
"lastname "
type=
"xs:string "
/>
<xs:element
name=
"country"
type=
"xs:string "
fixed=
"Norway"
/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
test/javax/xml/bind/xsom/8159240/identityConstraint.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<!-- Test spaces in xs:key and xs:keyref 'name'
and 'refer' attributes -->
<xs:element
name=
"root"
>
<xs:complexType>
<xs:sequence>
<xs:element
name=
"referenced"
>
<xs:complexType>
<xs:attribute
name=
"id"
type=
"xs:string"
/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key
name=
"aKey "
>
<xs:selector
xpath=
"root"
/>
<xs:field
xpath=
"@id"
/>
</xs:key>
<xs:keyref
name=
" aKeyRef "
refer=
" aKey"
>
<xs:selector
xpath=
"referenced"
/>
<xs:field
xpath=
"@id"
/>
</xs:keyref>
</xs:element>
</xs:schema>
test/javax/xml/bind/xsom/8159240/particlesAndAttributes.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<!-- Test spaces in 'xs:element' 'substitutionGroup' attribute -->
<xs:element
name=
" name"
type=
"xs:string"
/>
<xs:element
name=
"navn"
substitutionGroup=
" name "
/>
<!-- Test spaces in 'xs:element' 'name' and 'ref' attributes -->
<xs:element
name=
" address "
>
<xs:complexType>
<xs:sequence>
<xs:element
name=
"street"
type=
"xs:string"
/>
<xs:element
name=
"building"
type=
"xs:string"
/>
<xs:element
name=
"apt"
type=
"xs:int"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element
name=
"personinfo"
>
<xs:complexType>
<xs:all>
<xs:element
name=
"firstname"
type=
"xs:string"
/>
<xs:element
ref=
"address123 "
/>
<xs:element
name=
"city"
type=
"xs:string"
/>
<xs:element
name=
"country"
type=
"xs:string"
/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- Test spaces in xs:attribute 'name', 'type' and 'ref' attributes -->
<xs:simpleType
name=
"typeForAttribute "
>
<xs:restriction
base=
" xs:string"
>
<xs:pattern
value=
"[A-Z][A-Z]"
/>
</xs:restriction>
</xs:simpleType>
<xs:attribute
name=
" code"
type=
" typeForAttribute"
>
</xs:attribute>
<xs:complexType
name=
"TestComplexType"
>
<xs:attribute
ref=
"code "
/>
</xs:complexType>
<!-- Test spaces in xs:attributeGroup 'name' and 'ref' attributes -->
<xs:attributeGroup
name=
"personattr "
>
<xs:attribute
name=
"attr1"
type=
"xs:string"
/>
<xs:attribute
name=
"attr2"
type=
"xs:integer"
/>
</xs:attributeGroup>
<xs:complexType
name=
"person"
>
<xs:attributeGroup
ref=
" personattr "
/>
</xs:complexType>
<!-- Test spaces in <xs:group> 'name' and 'ref' attributes -->
<xs:group
name=
" customer"
>
<xs:sequence>
<xs:element
name=
"firstname"
type=
"xs:string"
/>
<xs:element
name=
"secondname"
type=
"xs:string"
/>
</xs:sequence>
</xs:group>
<xs:complexType
name=
"orderType"
>
<xs:group
ref=
"customer "
/>
<xs:attribute
name=
"itemId"
type=
"xs:integer"
/>
</xs:complexType>
<xs:element
name=
"order"
type=
"orderType"
/>
</xs:schema>
test/javax/xml/bind/xsom/8159240/simpleType.xsd
0 → 100644
浏览文件 @
c647758c
<?xml version="1.0"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<!-- Test spaces in elementDeclBody 'type' attribute -->
<xs:element
name=
"intvalues"
type=
"valuelist "
/>
<!-- Test spaces in simpleType 'name' attribute
and in inner <xs:list> 'itemType' attribute -->
<xs:simpleType
name=
" valuelist "
>
<xs:list
itemType=
" xs:integer "
/>
</xs:simpleType>
<!-- Test spaces in <xs:simpleType> -> <xs:restriction> 'base'
attribute -->
<xs:element
name=
"stringWithRestriction"
type=
" tenSizedString"
/>
<xs:simpleType
name=
" tenSizedString "
>
<xs:restriction
base=
" xs:string "
>
<xs:minLength
value=
"10"
/>
<xs:maxLength
value=
"10"
/>
</xs:restriction>
</xs:simpleType>
<!-- Test spaces in <xs:simpleType> -> <xs:union> 'memberTypes'
attribute -->
<xs:element
name=
"stringAndIntsUnion"
type=
" stringsAndInts "
/>
<xs:simpleType
name=
"stringsAndInts"
>
<xs:union
memberTypes=
" xs:integer xs:string
tenSizedString "
/>
</xs:simpleType>
</xs:schema>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录