author | duke |
Wed, 05 Jul 2017 20:24:54 +0200 | |
changeset 29530 | bfd405c818db |
parent 18521 | 80b48c6a64c9 |
permissions | -rw-r--r-- |
18521
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
1 |
/* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
4 |
* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
8 |
* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
14 |
* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
18 |
* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
21 |
* questions. |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
22 |
*/ |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
23 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
24 |
/* |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
25 |
* @test |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
26 |
* @bug 8016545 |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
27 |
* @summary Tests beans with predefined fields |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
28 |
* @author Sergey Malenkov |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
29 |
*/ |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
30 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
31 |
public class Test8016545 extends AbstractTest { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
32 |
public static void main(String[] args) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
33 |
new Test8016545().test(true); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
34 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
35 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
36 |
@Override |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
37 |
protected Object getObject() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
38 |
Bean bean = new Bean(); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
39 |
bean.setUndefined(Boolean.FALSE); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
40 |
Info info = new Info(); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
41 |
info.setEnabled(Boolean.TRUE); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
42 |
info.setID(1); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
43 |
bean.setInfo(info); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
44 |
return bean; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
45 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
46 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
47 |
@Override |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
48 |
protected Object getAnotherObject() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
49 |
Bean bean = new Bean(); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
50 |
bean.setUndefined(Boolean.TRUE); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
51 |
bean.getInfo().setEnabled(Boolean.FALSE); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
52 |
bean.getInfo().setID(2); |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
53 |
return bean; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
54 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
55 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
56 |
public static class Bean { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
57 |
private Info info = new Info(); // predefined |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
58 |
private Boolean defined = Boolean.TRUE; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
59 |
private Boolean undefined; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
60 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
61 |
public Info getInfo() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
62 |
return this.info; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
63 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
64 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
65 |
public void setInfo(Info info) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
66 |
this.info = info; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
67 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
68 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
69 |
public Boolean getDefined() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
70 |
return this.defined; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
71 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
72 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
73 |
public void setDefined(Boolean defined) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
74 |
this.defined = defined; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
75 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
76 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
77 |
public Boolean getUndefined() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
78 |
return this.undefined; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
79 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
80 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
81 |
public void setUndefined(Boolean undefined) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
82 |
this.undefined = undefined; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
83 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
84 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
85 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
86 |
public static class Info { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
87 |
private Integer id; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
88 |
private Boolean enabled; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
89 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
90 |
public Integer getID() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
91 |
return this.id; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
92 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
93 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
94 |
public void setID(Integer id) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
95 |
this.id = id; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
96 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
97 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
98 |
public Boolean getEnabled() { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
99 |
return this.enabled; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
100 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
101 |
|
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
102 |
public void setEnabled(Boolean enabled) { |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
103 |
this.enabled = enabled; |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
104 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
105 |
} |
80b48c6a64c9
8016545: java.beans.XMLEncoder.writeObject output is wrong
malenkov
parents:
diff
changeset
|
106 |
} |