
| Key: |
XSTR-276
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Assignee: |
Unassigned
|
| Reporter: |
Daniel Frey
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
XStream
Created: 20/Feb/06 03:34 AM
Updated: 07/Aug/06 09:13 PM
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
1.2
|
|
|
Issue Links:
|
Related
|
|
|
|
This issue is related to:
|
|
XSTR-283
Implicite Collections lead to wrong reference in plain XML text
|
|
|
|
|
|
|
| JDK version and platform: |
1.4.2_08-b03
|
|
Using a class with an implicite collection that has the same name as the class causes a doublicate id to be generated. Here is the test code:
public class Main {
public static void main(String[] args) {
final XStream x = new XStream(new DomDriver(new ClassPathEntityResolver("windows-1252")));
x.setMode(XStream.ID_REFERENCES);
x.alias("strings", Strings.class);
x.addImplicitCollection(Strings.class, "strings");
final Strings m = new Strings(new String[]{"Hallo", "Daniel"});
System.out.println(x.toXML(m));
}
}
class Strings {
private ArrayList strings = new ArrayList();
public Strings(String[] strings) {
this.strings.addAll(Arrays.asList(strings));
}
}
Leads to:
<strings id="1" id="2">
<string>Hallo</string>
<string>Daniel</string>
</strings>
Cheers
Daniel
|
|
Description
|
Using a class with an implicite collection that has the same name as the class causes a doublicate id to be generated. Here is the test code:
public class Main {
public static void main(String[] args) {
final XStream x = new XStream(new DomDriver(new ClassPathEntityResolver("windows-1252")));
x.setMode(XStream.ID_REFERENCES);
x.alias("strings", Strings.class);
x.addImplicitCollection(Strings.class, "strings");
final Strings m = new Strings(new String[]{"Hallo", "Daniel"});
System.out.println(x.toXML(m));
}
}
class Strings {
private ArrayList strings = new ArrayList();
public Strings(String[] strings) {
this.strings.addAll(Arrays.asList(strings));
}
}
Leads to:
<strings id="1" id="2">
<string>Hallo</string>
<string>Daniel</string>
</strings>
Cheers
Daniel |
Show » |
|