Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
Dragonwell11
提交
75be47d5
D
Dragonwell11
项目概览
LinuxSuRen
/
Dragonwell11
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
75be47d5
编写于
4月 16, 2019
作者:
J
joehw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8222415: Xerces 2.12.0: Parsing Configuration
Reviewed-by: lancea
上级
d987d2d6
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
229 addition
and
247 deletion
+229
-247
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
...sun/org/apache/xerces/internal/impl/XMLEntityManager.java
+206
-243
test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java
...jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java
+23
-4
未找到文件。
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
浏览文件 @
75be47d5
此差异已折叠。
点击以展开。
test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java
浏览文件 @
75be47d5
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017,
2019,
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
...
...
@@ -22,19 +22,22 @@
*/
package
parsers
;
import
java.io.ByteArrayInputStream
;
import
java.io.StringReader
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.stream.XMLInputFactory
;
import
javax.xml.stream.XMLStreamReader
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Listeners
;
import
org.testng.annotations.Test
;
import
org.w3c.dom.Document
;
import
org.xml.sax.InputSource
;
/**
* @test
* @bug 8169450
* @bug 8169450
8222415
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true parsers.BaseParsingTest
* @run testng/othervm parsers.BaseParsingTest
...
...
@@ -143,7 +146,7 @@ public class BaseParsingTest {
* @bug 8169450
* This particular issue does not appear in DOM parsing since the spaces are
* normalized during version detection. This test case then serves as a guard
* against such an issue from occuring in the version detection.
* against such an issue from occur
r
ing in the version detection.
*
* @param xml the test xml
* @throws Exception if the parser fails to parse the xml
...
...
@@ -151,8 +154,24 @@ public class BaseParsingTest {
@Test
(
dataProvider
=
"xmlDeclarations"
)
public
void
testWithDOM
(
String
xml
)
throws
Exception
{
DocumentBuilderFactory
dbf
=
DocumentBuilderFactory
.
newInstance
();
dbf
.
setValidating
(
true
);
DocumentBuilder
db
=
dbf
.
newDocumentBuilder
();
db
.
parse
(
new
InputSource
(
new
StringReader
(
xml
)));
}
/**
* @bug 8222415
* Verifies that the parser is configured properly for UTF-16BE or LE.
* @throws Exception
*/
@Test
public
void
testEncoding
()
throws
Exception
{
ByteArrayInputStream
bis
=
new
ByteArrayInputStream
(
"<?xml version=\"1.0\" encoding=\"UTF-16\"?> <a/>"
.
getBytes
(
"UnicodeLittle"
));
InputSource
is
=
new
InputSource
(
bis
);
DocumentBuilderFactory
dbf
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
db
=
dbf
.
newDocumentBuilder
();
Document
doc
=
db
.
parse
(
is
);
assertEquals
(
"UTF-16LE"
,
doc
.
getInputEncoding
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录