Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5b33ae62
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看板
提交
5b33ae62
编写于
5月 31, 2013
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
Reviewed-by: alexsch
上级
f6ad0fbd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
222 addition
and
1 deletion
+222
-1
src/share/classes/java/beans/XMLEncoder.java
src/share/classes/java/beans/XMLEncoder.java
+18
-1
test/java/beans/XMLEncoder/Test6989223.java
test/java/beans/XMLEncoder/Test6989223.java
+60
-0
test/java/beans/XMLEncoder/Test7080156.java
test/java/beans/XMLEncoder/Test7080156.java
+60
-0
test/java/beans/XMLEncoder/Test8013557.java
test/java/beans/XMLEncoder/Test8013557.java
+84
-0
未找到文件。
src/share/classes/java/beans/XMLEncoder.java
浏览文件 @
5b33ae62
...
@@ -487,6 +487,12 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
...
@@ -487,6 +487,12 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
}
}
indentation
--;
indentation
--;
Statement
statement
=
getMissedStatement
();
while
(
statement
!=
null
)
{
outputStatement
(
statement
,
this
,
false
);
statement
=
getMissedStatement
();
}
try
{
try
{
out
.
flush
();
out
.
flush
();
}
}
...
@@ -503,6 +509,17 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
...
@@ -503,6 +509,17 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
targetToStatementList
.
clear
();
targetToStatementList
.
clear
();
}
}
Statement
getMissedStatement
()
{
for
(
List
<
Statement
>
statements
:
this
.
targetToStatementList
.
values
())
{
for
(
int
i
=
0
;
i
<
statements
.
size
();
i
++)
{
if
(
Statement
.
class
==
statements
.
get
(
i
).
getClass
())
{
return
statements
.
remove
(
i
);
}
}
}
return
null
;
}
/**
/**
* This method calls <code>flush</code>, writes the closing
* This method calls <code>flush</code>, writes the closing
...
@@ -597,7 +614,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
...
@@ -597,7 +614,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
"methodName"
)
+
" should not be null"
);
"methodName"
)
+
" should not be null"
);
}
}
if
(
target
instanceof
Field
&&
methodName
.
equals
(
"get"
))
{
if
(
isArgument
&&
target
instanceof
Field
&&
methodName
.
equals
(
"get"
))
{
Field
f
=
(
Field
)
target
;
Field
f
=
(
Field
)
target
;
writeln
(
"<object class="
+
quote
(
f
.
getDeclaringClass
().
getName
())
+
writeln
(
"<object class="
+
quote
(
f
.
getDeclaringClass
().
getName
())
+
" field="
+
quote
(
f
.
getName
())
+
"/>"
);
" field="
+
quote
(
f
.
getName
())
+
"/>"
);
...
...
test/java/beans/XMLEncoder/Test6989223.java
0 → 100644
浏览文件 @
5b33ae62
/*
* Copyright (c) 2013, 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 6989223
* @summary Tests Rectangle2D.Double encoding
* @author Sergey Malenkov
*/
import
java.awt.geom.Rectangle2D
;
public
class
Test6989223
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test6989223
().
test
(
true
);
}
protected
Object
getObject
()
{
return
new
Bean
(
1
,
2
,
3
,
4
);
}
@Override
protected
Object
getAnotherObject
()
{
return
new
Bean
(
1
,
2
,
3
,
5
);
}
public
static
class
Bean
extends
Rectangle2D
.
Double
{
public
Bean
()
{
}
public
Bean
(
double
x
,
double
y
,
double
w
,
double
h
)
{
super
(
x
,
y
,
w
,
h
);
}
@Override
public
boolean
equals
(
Object
object
)
{
return
super
.
equals
(
object
);
// to avoid recursion during validation
}
}
}
test/java/beans/XMLEncoder/Test7080156.java
0 → 100644
浏览文件 @
5b33ae62
/*
* Copyright (c) 2013, 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 7080156 7094245
* @summary Tests beans with public arrays
* @author Sergey Malenkov
*/
public
class
Test7080156
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test7080156
().
test
(
true
);
}
protected
Object
getObject
()
{
Bean
bean
=
new
Bean
();
bean
.
setArray
(
"something"
);
return
bean
;
}
@Override
protected
Object
getAnotherObject
()
{
Bean
bean
=
new
Bean
();
bean
.
setArray
(
"some"
,
"thing"
);
return
bean
;
}
public
static
class
Bean
{
public
String
[]
array
=
{
"default"
};
public
void
setArray
(
String
...
array
)
{
this
.
array
=
array
;
}
public
String
[]
getArray
()
{
return
this
.
array
;
}
}
}
test/java/beans/XMLEncoder/Test8013557.java
0 → 100644
浏览文件 @
5b33ae62
/*
* Copyright (c) 2013, 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 8013557
* @summary Tests beans with public fields
* @author Sergey Malenkov
*/
public
class
Test8013557
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test8013557
().
test
(
true
);
}
protected
Object
getObject
()
{
return
new
Bean
(
new
Value
(
"something"
));
}
@Override
protected
Object
getAnotherObject
()
{
return
new
Bean
(
new
Value
());
}
public
static
class
Bean
{
public
Value
value
;
public
Bean
()
{
this
.
value
=
new
Value
();
}
public
Bean
(
Value
value
)
{
this
.
value
=
value
;
}
public
void
setValue
(
Value
value
)
{
this
.
value
=
value
;
}
public
Value
getValue
()
{
return
this
.
value
;
}
}
public
static
class
Value
{
private
String
string
;
public
Value
()
{
this
.
string
=
"default"
;
}
public
Value
(
String
value
)
{
this
.
string
=
value
;
}
public
void
setString
(
String
string
)
{
this
.
string
=
string
;
}
public
String
getString
()
{
return
this
.
string
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录