simple-support Mailing List for Simple (Page 67)
Brought to you by:
niallg
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(13) |
May
(13) |
Jun
(27) |
Jul
(4) |
Aug
(14) |
Sep
(7) |
Oct
|
Nov
(6) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
(15) |
May
(24) |
Jun
(24) |
Jul
(30) |
Aug
(5) |
Sep
(19) |
Oct
(27) |
Nov
(16) |
Dec
(24) |
| 2009 |
Jan
(34) |
Feb
(24) |
Mar
(35) |
Apr
(26) |
May
(8) |
Jun
(17) |
Jul
(28) |
Aug
(31) |
Sep
(36) |
Oct
(35) |
Nov
(20) |
Dec
(16) |
| 2010 |
Jan
(40) |
Feb
(21) |
Mar
(47) |
Apr
(45) |
May
(34) |
Jun
(68) |
Jul
(46) |
Aug
(39) |
Sep
(47) |
Oct
(20) |
Nov
(42) |
Dec
(13) |
| 2011 |
Jan
(41) |
Feb
(16) |
Mar
(32) |
Apr
(44) |
May
(28) |
Jun
(35) |
Jul
(37) |
Aug
(33) |
Sep
(60) |
Oct
(20) |
Nov
(35) |
Dec
(23) |
| 2012 |
Jan
(34) |
Feb
(23) |
Mar
(34) |
Apr
(21) |
May
(48) |
Jun
(24) |
Jul
(31) |
Aug
(39) |
Sep
(25) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(24) |
Apr
(9) |
May
(4) |
Jun
(6) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
(5) |
Nov
(1) |
Dec
(12) |
| 2014 |
Jan
(14) |
Feb
(16) |
Mar
(5) |
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jim S. <ji...@fu...> - 2009-03-02 19:26:15
|
Hi, I'm evaluating Simple along with some other tools that will serialize data for purposes of data transfer across a network. I much prefer the annotations-based way that Simple lets me prepare data for serialization to the other tool I'm evaluating (Google protobuf), but the performance is becoming a determining factor. For example, a sample data structure which takes 1.53ms to encode with Simple only takes 0.048ms to encode with protobuf. I'm just doing a very simple standard annotation markup with @Attribute and @Element (the outer structure has a dozen fields and a list of two inner structures, each having about a half-dozen fields). Then I just use persister.write to serialize. I'm guessing maybe the reflection is taking a lot of time? Not sure. But are there any known performance tips/tricks to know about with Simple? Thanks, Jim CONFIDENTIAL This document and attachments contain information from Fusion-io, Inc. which is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this transmission. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this emailed information is strictly prohibited, and that the documents should be returned to Fusion-io, Inc. immediately. In this regard, if you have received this email in error, please notify us by return email immediately. |
|
From: saurabh s. <sau...@ya...> - 2009-03-02 06:40:58
|
One way to achieve this is on the same lines of JAXB.
You can have an annotation like this:
@ElementRef(class="<comma-separared list of all the implementing classes>"). Now when you serialize, you can use the name of the actual implementing class itself that is contained within the vairable or use the name from the annotation on that class.
While deserializing, you can match the name of the tag from the xml to a name from the list or their annotations and create an instance of the actual implementing class.
E.g
public
@ElementRef(class="Impl1.class, Impl2.class")
public Iface iface;
}
public class Impl1 implements Iface {
}
public class Impl2 implementsIface {Regards,
}
XML - 1:
<?
<xml version="1.0" encoding="UTF-8"?>root>
<impl1></impl1>root>
</
XML - 2:
<?
<xml version="1.0" encoding="UTF-8"?>root>
<impl2></impl2>root>
</
class Root {
Saurabh.
________________________________
From: Niall Gallagher <gal...@ya...>
To: "sim...@li..." <sim...@li...>; Sacchi Giovanna <gio...@te...>; saurabh sule <sau...@ya...>
Sent: Friday, 27 February, 2009 6:15:31 PM
Subject: Re: [Simple-support] Problem with override
Hi,
Actually, you are right, it will call all instances "reference". Did not see the different types mentioned. Here the problem is how to match the element with the field. If the names do not match, either by field name or by the name attribute on the annotation then there is no real way to match the element or attribute with the field or method.
However, I welcome any proposals for how to do this, either via an extra annotation or some other scheme.
Thanks,
Niall
--- On Thu, 2/26/09, saurabh sule <sau...@ya...> wrote:
From: saurabh sule <sau...@ya...>
Subject: Re: [Simple-support] Problem with override
To: gal...@ya..., "sim...@li..." <sim...@li...>, "Sacchi Giovanna" <gio...@te...>
Date: Thursday, February 26, 2009, 6:12 PM
Hi,
But this solution will always serialize the Formula to "reference", am I right?
What if one wants to have "reference" , "constant" or "function" depending on the actual implementation?
Is this possible?
Regards,
Saurabh.
________________________________
From: Niall Gallagher <gal...@ya...>
To: "sim...@li..." <sim...@li...>; Sacchi Giovanna <gio...@te...>
Sent: Thursday, 26 February, 2009 6:20:32 PM
Subject: Re: [Simple-support] Problem with override
Hi,
Just name the @Element like so.
@Element(name="reference")
Formula formula;
This will serialize the Formula class as "reference".
Hope this helps,
Niall
--- On Thu, 2/26/09, Sacchi Giovanna <gio...@te...> wrote:
From: Sacchi Giovanna <gio...@te...>
Subject: [Simple-support] Problem with override
To: "sim...@li..." <sim...@li...>
Date: Thursday, February 26, 2009, 3:13 AM
Hi,
I’m trying to serialize a class similar to this one:
publicclassBinding {
@Attribute
privateType type;
@Attribute
privateString name;
@Attribute
privateSide side;
@Attribute(required=false)
privateString part;
@Element
privateFormula formula;
...
}
Where Formula is an interface implemented by three classes: Constant, Function and Reference. For instance, I have annotated the Reference class, like that:
publicclassReference implementsFormula {
@Attribute
privateString activity;
@Attribute
privateType type;
@Attribute
privateString name;
@Attribute
privateSide side;
...
}
When the Binding class is serialized the following xml file is produced:
<bindingtype="NORMAL" name="par21" side="IN">
<formulaclass="com.tilab.wemash.model.Reference" activity="webServiceActivity1" type="NORMAL" name="par11" side="OUT"/>
</binding>
I would like to know if it there is any way to produce, instead, the following xml:
<bindingtype="NORMAL" name="par21" side="IN">
<referenceclass="com.tilab.wemash.model.Reference" activity="webServiceActivity1" type="NORMAL" name="par11" side="OUT"/>
</binding>
That is: when the element formula of the Binding is serialized, I want that the name of the class Reference is used as element name instead of the name of the interface implemented by the class Reference.
Regards,
Giovanna
------------------------------------------------------------------
Telecom Italia
Giovanna Sacchi
Information Technology
Innovation, Architecture & Quality
IT Innovation
Via G. Reiss Romoli, 274 - 10148 Torino
+ 39 011 2288040
+ 39 331 6001656
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie.
This e-mail and any attachments is confidential and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorised. If you are not the intended recipient, please delete this message and any attachments and advise the sender by return e-mail, Thanks.Rispetta l'ambiente. Non stampare questa mail se non è necessario.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
________________________________
Add more friends to your messenger and enjoy! Invite them now.
Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/ |
|
From: Niall G. <gal...@ya...> - 2009-02-27 12:45:41
|
Hi,
Actually, you are right, it will call all instances "reference". Did not see the different types mentioned. Here the problem is how to match the element with the field. If the names do not match, either by field name or by the name attribute on the annotation then there is no real way to match the element or attribute with the field or method.
However, I welcome any proposals for how to do this, either via an extra annotation or some other scheme.
Thanks,
Niall
--- On Thu, 2/26/09, saurabh sule <sau...@ya...> wrote:
From: saurabh sule <sau...@ya...>
Subject: Re: [Simple-support] Problem with override
To: gal...@ya..., "sim...@li..." <sim...@li...>, "Sacchi Giovanna" <gio...@te...>
Date: Thursday, February 26, 2009, 6:12 PM
Hi,
But this solution will always serialize the Formula to "reference", am I right?
What if one wants to have "reference" , "constant" or "function" depending on the actual implementation?
Is this possible?
Regards,
Saurabh.
From: Niall Gallagher <gal...@ya...>
To: "sim...@li..." <sim...@li...>; Sacchi Giovanna <gio...@te...>
Sent: Thursday, 26 February, 2009 6:20:32 PM
Subject: Re: [Simple-support] Problem with override
Hi,
Just name the @Element like so.
@Element(name="reference")
Formula formula;
This will serialize the Formula class as "reference".
Hope this helps,
Niall
--- On Thu, 2/26/09, Sacchi Giovanna <gio...@te...> wrote:
From: Sacchi Giovanna <gio...@te...>
Subject: [Simple-support]
Problem with override
To: "sim...@li..." <sim...@li...>
Date: Thursday, February 26, 2009, 3:13 AM
Hi,
I’m trying to serialize a class similar to this one:
public
class
Binding {
@Attribute
private
Type type;
@Attribute
private
String name;
@Attribute
private
Side side;
@Attribute
(required=false)
private
String part;
@Element
private
Formula formula;
...
}
Where Formula is an interface implemented by three classes: Constant, Function and Reference. For instance,
I have annotated the Reference class, like that:
public
class
Reference implements
Formula {
@Attribute
private
String activity;
@Attribute
private
Type type;
@Attribute
private
String name;
@Attribute
private
Side side;
...
}
When the Binding class is serialized the following xml file is produced:
<binding
type="NORMAL"
name="par21"
side="IN">
<formula
class="com.tilab.wemash.model.Reference"
activity="webServiceActivity1"
type="NORMAL"
name="par11"
side="OUT"/>
</binding>
I would like to know if it there is any way to produce, instead, the following xml:
<binding
type="NORMAL"
name="par21"
side="IN">
<reference
class="com.tilab.wemash.model.Reference"
activity="webServiceActivity1"
type="NORMAL"
name="par11"
side="OUT"/>
</binding>
That is: when the element formula of the Binding is serialized, I want that the name of the class Reference
is used as element name instead of the name of the interface implemented by the class Reference.
Regards,
Giovanna
------------------------------------------------------------------
Telecom Italia
Giovanna Sacchi
Information Technology
Innovation, Architecture & Quality
IT Innovation
Via G. Reiss Romoli, 274 - 10148 Torino
+ 39 011 2288040
+ 39 331 6001656
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi
altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie.
This e-mail and any attachments is confidential
and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorised. If you are not the intended recipient, please delete this message and any attachments and advise the sender
by return e-mail, Thanks.
Rispetta l'ambiente. Non stampare questa mail se non è necessario.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Add more friends to your messenger and enjoy! Invite them now.
|
|
From: saurabh s. <sau...@ya...> - 2009-02-27 02:12:49
|
Hi,
But this solution will always serialize the Formula to "reference", am I right?
What if one wants to have "reference" , "constant" or "function" depending on the actual implementation?
Is this possible?
Regards,
Saurabh.
________________________________
From: Niall Gallagher <gal...@ya...>
To: "sim...@li..." <sim...@li...>; Sacchi Giovanna <gio...@te...>
Sent: Thursday, 26 February, 2009 6:20:32 PM
Subject: Re: [Simple-support] Problem with override
Hi,
Just name the @Element like so.
@Element(name="reference")
Formula formula;
This will serialize the Formula class as "reference".
Hope this helps,
Niall
--- On Thu, 2/26/09, Sacchi Giovanna <gio...@te...> wrote:
From: Sacchi Giovanna <gio...@te...>
Subject: [Simple-support] Problem with override
To: "sim...@li..." <sim...@li...>
Date: Thursday, February 26, 2009, 3:13 AM
Hi,
I’m trying to serialize a class similar to this one:
publicclassBinding {
@Attribute
privateType type;
@Attribute
privateString name;
@Attribute
privateSide side;
@Attribute(required=false)
privateString part;
@Element
privateFormula formula;
...
}
Where Formula is an interface implemented by three classes: Constant, Function and Reference. For instance, I have annotated the Reference class, like that:
publicclassReference implementsFormula {
@Attribute
privateString activity;
@Attribute
privateType type;
@Attribute
privateString name;
@Attribute
privateSide side;
...
}
When the Binding class is serialized the following xml file is produced:
<bindingtype="NORMAL" name="par21" side="IN">
<formulaclass="com.tilab.wemash.model.Reference" activity="webServiceActivity1" type="NORMAL" name="par11" side="OUT"/>
</binding>
I would like to know if it there is any way to produce, instead, the following xml:
<bindingtype="NORMAL" name="par21" side="IN">
<referenceclass="com.tilab.wemash.model.Reference" activity="webServiceActivity1" type="NORMAL" name="par11" side="OUT"/>
</binding>
That is: when the element formula of the Binding is serialized, I want that the name of the class Reference is used as element name instead of the name of the interface implemented by the class Reference.
Regards,
Giovanna
------------------------------------------------------------------
Telecom Italia
Giovanna Sacchi
Information Technology
Innovation, Architecture & Quality
IT Innovation
Via G. Reiss Romoli, 274 - 10148 Torino
+ 39 011 2288040
+ 39 331 6001656
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie.
This e-mail and any attachments is confidential and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorised. If you are not the intended recipient, please delete this message and any attachments and advise the sender by return e-mail, Thanks.Rispetta l'ambiente. Non stampare questa mail se non è necessario.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/ |
|
From: Joselito D. M. <joe...@gm...> - 2009-02-26 18:15:27
|
Never mind. I found it.
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.0.3</version>
</dependency>
---------- Forwarded message ----------
From: Joselito D. Moreno <joe...@gm...>
Date: Thu, Feb 26, 2009 at 12:12 PM
Subject: Is Simple 2.0.3 in any of the central Maven 2 repository?
To: sim...@li...
Is Simple 2.0.3 in maven central repository somewhere? If so, how does the
dependency entry in the pom.xml look like?
Thanks,
Joen Moreno
|
|
From: Joselito D. M. <joe...@gm...> - 2009-02-26 18:12:18
|
Is Simple 2.0.3 in maven central repository somewhere? If so, how does the dependency entry in the pom.xml look like? Thanks, Joen Moreno |
|
From: Niall G. <gal...@ya...> - 2009-02-26 12:57:18
|
Hi,
Just name the @Element like so.
@Element(name="reference")
Formula formula;
This will serialize the Formula class as "reference".
Hope this helps,
Niall
--- On Thu, 2/26/09, Sacchi Giovanna <gio...@te...> wrote:
From: Sacchi Giovanna <gio...@te...>
Subject: [Simple-support] Problem with override
To: "sim...@li..." <sim...@li...>
Date: Thursday, February 26, 2009, 3:13 AM
Hi,
I’m trying to serialize a class similar to this one:
public
class
Binding {
@Attribute
private
Type type;
@Attribute
private
String name;
@Attribute
private
Side side;
@Attribute
(required=false)
private
String part;
@Element
private
Formula formula;
...
}
Where Formula is an interface implemented by three classes: Constant, Function and Reference. For instance,
I have annotated the Reference class, like that:
public
class
Reference implements
Formula {
@Attribute
private
String activity;
@Attribute
private
Type type;
@Attribute
private
String name;
@Attribute
private
Side side;
...
}
When the Binding class is serialized the following xml file is produced:
<binding
type="NORMAL"
name="par21"
side="IN">
<formula
class="com.tilab.wemash.model.Reference"
activity="webServiceActivity1"
type="NORMAL"
name="par11"
side="OUT"/>
</binding>
I would like to know if it there is any way to produce, instead, the following xml:
<binding
type="NORMAL"
name="par21"
side="IN">
<reference
class="com.tilab.wemash.model.Reference"
activity="webServiceActivity1"
type="NORMAL"
name="par11"
side="OUT"/>
</binding>
That is: when the element formula of the Binding is serialized, I want that the name of the class Reference
is used as element name instead of the name of the interface implemented by the class Reference.
Regards,
Giovanna
------------------------------------------------------------------
Telecom Italia
Giovanna Sacchi
Information Technology
Innovation, Architecture & Quality
IT Innovation
Via G. Reiss Romoli, 274 - 10148 Torino
+ 39 011 2288040
+ 39 331 6001656
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi
altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie.
This e-mail and any attachments is confidential
and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorised. If you are not the intended recipient, please delete this message and any attachments and advise the sender
by return e-mail, Thanks.
Rispetta l'ambiente. Non stampare questa mail se non è necessario.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Niall G. <gal...@ya...> - 2009-02-23 22:39:00
|
Hi, If you could send me a test case that would be great. Empty elements are null in Simple. There is an empty= attribute on @Attribute and @Text which let you specify a substitute to null. For example @Attribute(empty="[NULL]") private String name; This will mean an attribute of <element name="[NULL]"> Will deserialize the attribute name null. Also text like @Text(empty="This is null") private String value; <text>This is null</text> Will deserialize to null. However there is no such setting for a value in a map. I would greatly appreciate it if you could supply a test case to help me improve the overall stability of the project. Looks like an edge case around representing primitives as java.lang.Object again. Thanks, Niall --- On Mon, 2/23/09, Alan Deikman <Ala...@zn...> wrote: > From: Alan Deikman <Ala...@zn...> > Subject: [Simple-support] Avoiding NullPointerException > To: sim...@li... > Date: Monday, February 23, 2009, 1:20 PM > Niall, > > Thanks for the recent update to 2.0.3. It wasn't > holding me up but it is great to get past that problem. > > On to something else: I think this has been discussed > before, but I couldn't find it in the archives. It has > to do with serializing the empty String value: "". > When reading it back in, you get a NullPointerException if > the element is not marked required=false. > > So how do we deal with that in a collection? My test case > produces the following document: > > <simpleBug1 id="0"> > <test1 id="1"> > <data id="2"> > <entry> > <string > id="3">key1</string> > <object class="java.lang.String" > id="4">value</object> > </entry> > <entry> > <string > id="5">key2</string> > <object class="java.lang.String" > id="6"></object> > </entry> > </data> > </test1> > </simpleBug1> > > Reading it back in gets: > > Exception: java.lang.NullPointerException > java.lang.NullPointerException > at > org.simpleframework.xml.core.Traverser.read(Traverser.java:79) > at > org.simpleframework.xml.core.CompositeValue.read(CompositeValue.java:102) > at > org.simpleframework.xml.core.CompositeMap.populate(CompositeMap.java:177) > > etc. If you want me to send you the test case let me know, > but again I don't know if this is a problem with simple > or something I sould be doing but ain't. Thanks again. > > -- > Alan Deikman > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, > San Francisco, CA > -OSBC tackles the biggest issue in open source: Open > Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open > source participation > -Receive a $600 discount off the registration fee with the > source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Alan D. <Ala...@zn...> - 2009-02-23 21:20:25
|
Niall,
Thanks for the recent update to 2.0.3. It wasn't holding me up but it is great to get past that problem.
On to something else: I think this has been discussed before, but I couldn't find it in the archives. It has to do with serializing the empty String value: "". When reading it back in, you get a NullPointerException if the element is not marked required=false.
So how do we deal with that in a collection? My test case produces the following document:
<simpleBug1 id="0">
<test1 id="1">
<data id="2">
<entry>
<string id="3">key1</string>
<object class="java.lang.String" id="4">value</object>
</entry>
<entry>
<string id="5">key2</string>
<object class="java.lang.String" id="6"></object>
</entry>
</data>
</test1>
</simpleBug1>
Reading it back in gets:
Exception: java.lang.NullPointerException
java.lang.NullPointerException
at org.simpleframework.xml.core.Traverser.read(Traverser.java:79)
at org.simpleframework.xml.core.CompositeValue.read(CompositeValue.java:102)
at org.simpleframework.xml.core.CompositeMap.populate(CompositeMap.java:177)
etc. If you want me to send you the test case let me know, but again I don't know if this is a problem with simple or something I sould be doing but ain't. Thanks again.
--
Alan Deikman
|
|
From: Niall G. <gal...@ya...> - 2009-02-20 18:38:36
|
Hi,
Simple 2.0.3 has been released. It contains a fix for primitive references as well as a fix for collection references.
Regards,
Niall
--- On Fri, 2/20/09, Nia...@ub... <Nia...@ub...> wrote:
> From: Nia...@ub... <Nia...@ub...>
> Subject: RE: [Simple-support] De-serialization problem -- valid referencenot valid?
> To: gal...@ya..., sim...@li..., Ala...@zn...
> Date: Friday, February 20, 2009, 3:39 AM
> Hi,
>
> Yes this is a bug that was introduced with a recent
> enhancement to be
> able to write primitives from Object fields and also mix
> primitives
> within a list or map. I have resolved the issue and will
> release a minor
> version tonight with the fix. 2.0.3.
>
> Thanks for the feedback,
> Niall
>
> -----Original Message-----
> From: Niall Gallagher [mailto:gal...@ya...]
> Sent: 17 February 2009 23:33
> To: sim...@li...; Alan Deikman
> Subject: Re: [Simple-support] De-serialization problem --
> valid
> referencenot valid?
>
> Hi,
>
> Thanks, ill take a look.
>
> Niall
>
>
> --- On Tue, 2/17/09, Alan Deikman
> <Ala...@zn...> wrote:
>
> > From: Alan Deikman <Ala...@zn...>
> > Subject: Re: [Simple-support] De-serialization problem
> -- valid
> reference not valid?
> > To: sim...@li...
> > Date: Tuesday, February 17, 2009, 3:10 PM Niall
> Gallagher wrote:
> > > Is this easy to reproduce? Would it be possible
> to
> > write a test case to expose this problem, at least
> then I could fix
> > the issue from a known reproducable test.
> > >
> >
> > OK, I think I have test case for you in the attached
> file.
> > The program run without a command-line parameter will
> write
> > the file "SimpleBug.xml". If you run it
> with the
> > command line parameter "-r" it will try to
> read
> > that file, with the exception. The exception I got
> was:
> >
> > org.simpleframework.xml.graph.CycleException:
> Invalid reference '4'
>
> > found
> >
> > The file it should generate (but can't read) looks
> like
> > this:
> >
> > <simpleBug id="0">
> > <test1 id="1">
> > <data id="2">
> > <entry>
> > <string
> > id="3">key1</string>
> > <object
> class="java.lang.String"
> > id="4">value</object>
> > </entry>
> > </data>
> > </test1>
> > <test2 id="5">
> > <data id="6">
> > <entry>
> > <string
> > id="7">key2</string>
> > <object
> class="java.lang.String"
> > ref="4"/>
> > </entry>
> > </data>
> > </test2>
> > </simpleBug>
> >
> > Thanks again for this great class library.
> >
> > -- Alan Deikman
> > ZNYX Networks
> >
> > /*
> > * SimpleBug.java
> > *
> > */
> >
> > package com.test.teststuff;
> >
> > import java.io.File;
> > import java.util.TreeMap;
> > import org.simpleframework.xml.Element; import
> > org.simpleframework.xml.ElementMap;
> > import org.simpleframework.xml.Root;
> > import org.simpleframework.xml.Serializer;
> > import org.simpleframework.xml.core.Persister;
> > import org.simpleframework.xml.core.Strategy;
> > import org.simpleframework.xml.graph.CycleStrategy;
> >
> > /**
> > *
> > * @author Alan Deikman
> > */
> > @Root public class SimpleBug {
> >
> > @Element protected Mojo test1;
> > @Element protected Mojo test2;
> >
> > public SimpleBug() {
> > test1 = new Mojo();
> > test1.data.put("key1",
> > "value");
> > test2 = new Mojo();
> > test2.data.put("key2",
> > "value");
> > }
> >
> > /**
> > * @param args the command line arguments
> > */
> > public static void main(String[] args) {
> >
> > SimpleBug bug = null;
> >
> > boolean write = true;
> > if (args.length > 0 &&
> > args[0].equals("-r")) write = false;
> >
> > Strategy resolver = new
> > CycleStrategy("id", "ref");
> > Serializer s = new Persister(resolver);
> > File file = new
> File("SimpleBug.xml");
> >
> > if (write) {
> > bug = new SimpleBug();
> > try {
> > s.write(bug, file);
> > } catch (Exception ex) {
> > System.out.println("Something
> went wrong.");
> > }
> > }
> >
> > else {
> > try {
> > bug = s.read(SimpleBug.class, file);
> > } catch (Exception ex) {
> > System.out.println("Can't
> parse");
> > System.out.println(ex.toString());
> > }
> > }
> > }
> >
> > public static class Mojo {
> > @ElementMap protected TreeMap<String,
> Object> data;
> > public Mojo() {
> > data = new TreeMap<String,
> Object>();
> > }
> > }
> >
> > }
> >
> ----------------------------------------------------------------------
> > -------- Open Source Business Conference (OSBC), March
> 24-25, 2009,
> > San Francisco, CA -OSBC tackles the biggest issue in
> open source: Open
>
> > Sourcing the Enterprise -Strategies to boost
> innovation and cut costs
> > with open source participation -Receive a $600
> discount off the
> > registration fee with the source code: SFAD
> >
> http://p.sf.net/sfu/XcvMzF8H__________________________________________
> > _____
> > Simple-support mailing list
> > Sim...@li...
> >
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
>
> ------------------------------------------------------------------------
> ------
> Open Source Business Conference (OSBC), March 24-25, 2009,
> San
> Francisco, CA -OSBC tackles the biggest issue in open
> source: Open
> Sourcing the Enterprise -Strategies to boost innovation and
> cut costs
> with open source participation -Receive a $600 discount off
> the
> registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
> Visit our website at http://www.ubs.com
>
> This message contains confidential information and is
> intended only
> for the individual named. If you are not the named
> addressee you
> should not disseminate, distribute or copy this e-mail.
> Please
> notify the sender immediately by e-mail if you have
> received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mails are not encrypted and cannot be guaranteed to be
> secure or
> error-free as information could be intercepted, corrupted,
> lost,
> destroyed, arrive late or incomplete, or contain viruses.
> The sender
> therefore does not accept liability for any errors or
> omissions in the
> contents of this message which arise as a result of e-mail
> transmission.
> If verification is required please request a hard-copy
> version. This
> message is provided for informational purposes and should
> not be
> construed as a solicitation or offer to buy or sell any
> securities
> or related financial instruments.
>
> UBS Limited is a company registered in England & Wales
> under company
> number 2035362, whose registered office is at 1 Finsbury
> Avenue,
> London, EC2M 2PP, United Kingdom.
>
> UBS AG (London Branch) is registered as a branch of a
> foreign company
> under number BR004507, whose registered office is at
> 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
>
> UBS Clearing and Execution Services Limited is a company
> registered
> in England & Wales under company number 03123037, whose
> registered
> office is at 1 Finsbury Avenue, London, EC2M 2PP, United
> Kingdom.
|
|
From: <Nia...@ub...> - 2009-02-20 13:48:44
|
Hi,
Yes this is a bug that was introduced with a recent enhancement to be
able to write primitives from Object fields and also mix primitives
within a list or map. I have resolved the issue and will release a minor
version tonight with the fix. 2.0.3.
Thanks for the feedback,
Niall
-----Original Message-----
From: Niall Gallagher [mailto:gal...@ya...]
Sent: 17 February 2009 23:33
To: sim...@li...; Alan Deikman
Subject: Re: [Simple-support] De-serialization problem -- valid
referencenot valid?
Hi,
Thanks, ill take a look.
Niall
--- On Tue, 2/17/09, Alan Deikman <Ala...@zn...> wrote:
> From: Alan Deikman <Ala...@zn...>
> Subject: Re: [Simple-support] De-serialization problem -- valid
reference not valid?
> To: sim...@li...
> Date: Tuesday, February 17, 2009, 3:10 PM Niall Gallagher wrote:
> > Is this easy to reproduce? Would it be possible to
> write a test case to expose this problem, at least then I could fix
> the issue from a known reproducable test.
> >
>
> OK, I think I have test case for you in the attached file.
> The program run without a command-line parameter will write
> the file "SimpleBug.xml". If you run it with the
> command line parameter "-r" it will try to read
> that file, with the exception. The exception I got was:
>
> org.simpleframework.xml.graph.CycleException: Invalid reference '4'
> found
>
> The file it should generate (but can't read) looks like
> this:
>
> <simpleBug id="0">
> <test1 id="1">
> <data id="2">
> <entry>
> <string
> id="3">key1</string>
> <object class="java.lang.String"
> id="4">value</object>
> </entry>
> </data>
> </test1>
> <test2 id="5">
> <data id="6">
> <entry>
> <string
> id="7">key2</string>
> <object class="java.lang.String"
> ref="4"/>
> </entry>
> </data>
> </test2>
> </simpleBug>
>
> Thanks again for this great class library.
>
> -- Alan Deikman
> ZNYX Networks
>
> /*
> * SimpleBug.java
> *
> */
>
> package com.test.teststuff;
>
> import java.io.File;
> import java.util.TreeMap;
> import org.simpleframework.xml.Element; import
> org.simpleframework.xml.ElementMap;
> import org.simpleframework.xml.Root;
> import org.simpleframework.xml.Serializer;
> import org.simpleframework.xml.core.Persister;
> import org.simpleframework.xml.core.Strategy;
> import org.simpleframework.xml.graph.CycleStrategy;
>
> /**
> *
> * @author Alan Deikman
> */
> @Root public class SimpleBug {
>
> @Element protected Mojo test1;
> @Element protected Mojo test2;
>
> public SimpleBug() {
> test1 = new Mojo();
> test1.data.put("key1",
> "value");
> test2 = new Mojo();
> test2.data.put("key2",
> "value");
> }
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
>
> SimpleBug bug = null;
>
> boolean write = true;
> if (args.length > 0 &&
> args[0].equals("-r")) write = false;
>
> Strategy resolver = new
> CycleStrategy("id", "ref");
> Serializer s = new Persister(resolver);
> File file = new File("SimpleBug.xml");
>
> if (write) {
> bug = new SimpleBug();
> try {
> s.write(bug, file);
> } catch (Exception ex) {
> System.out.println("Something went wrong.");
> }
> }
>
> else {
> try {
> bug = s.read(SimpleBug.class, file);
> } catch (Exception ex) {
> System.out.println("Can't parse");
> System.out.println(ex.toString());
> }
> }
> }
>
> public static class Mojo {
> @ElementMap protected TreeMap<String, Object> data;
> public Mojo() {
> data = new TreeMap<String, Object>();
> }
> }
>
> }
> ----------------------------------------------------------------------
> -------- Open Source Business Conference (OSBC), March 24-25, 2009,
> San Francisco, CA -OSBC tackles the biggest issue in open source: Open
> Sourcing the Enterprise -Strategies to boost innovation and cut costs
> with open source participation -Receive a $600 discount off the
> registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H__________________________________________
> _____
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
------------------------------------------------------------------------
------
Open Source Business Conference (OSBC), March 24-25, 2009, San
Francisco, CA -OSBC tackles the biggest issue in open source: Open
Sourcing the Enterprise -Strategies to boost innovation and cut costs
with open source participation -Receive a $600 discount off the
registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mails are not encrypted and cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities
or related financial instruments.
UBS Limited is a company registered in England & Wales under company
number 2035362, whose registered office is at 1 Finsbury Avenue,
London, EC2M 2PP, United Kingdom.
UBS AG (London Branch) is registered as a branch of a foreign company
under number BR004507, whose registered office is at
1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS Clearing and Execution Services Limited is a company registered
in England & Wales under company number 03123037, whose registered
office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
|
|
From: Niall G. <gal...@ya...> - 2009-02-17 23:33:15
|
Hi,
Thanks, ill take a look.
Niall
--- On Tue, 2/17/09, Alan Deikman <Ala...@zn...> wrote:
> From: Alan Deikman <Ala...@zn...>
> Subject: Re: [Simple-support] De-serialization problem -- valid reference not valid?
> To: sim...@li...
> Date: Tuesday, February 17, 2009, 3:10 PM
> Niall Gallagher wrote:
> > Is this easy to reproduce? Would it be possible to
> write a test case to expose this problem, at least then I
> could fix the issue from a known reproducable test.
> >
>
> OK, I think I have test case for you in the attached file.
> The program run without a command-line parameter will write
> the file "SimpleBug.xml". If you run it with the
> command line parameter "-r" it will try to read
> that file, with the exception. The exception I got was:
>
> org.simpleframework.xml.graph.CycleException: Invalid
> reference '4' found
>
> The file it should generate (but can't read) looks like
> this:
>
> <simpleBug id="0">
> <test1 id="1">
> <data id="2">
> <entry>
> <string
> id="3">key1</string>
> <object class="java.lang.String"
> id="4">value</object>
> </entry>
> </data>
> </test1>
> <test2 id="5">
> <data id="6">
> <entry>
> <string
> id="7">key2</string>
> <object class="java.lang.String"
> ref="4"/>
> </entry>
> </data>
> </test2>
> </simpleBug>
>
> Thanks again for this great class library.
>
> -- Alan Deikman
> ZNYX Networks
>
> /*
> * SimpleBug.java
> *
> */
>
> package com.test.teststuff;
>
> import java.io.File;
> import java.util.TreeMap;
> import org.simpleframework.xml.Element;
> import org.simpleframework.xml.ElementMap;
> import org.simpleframework.xml.Root;
> import org.simpleframework.xml.Serializer;
> import org.simpleframework.xml.core.Persister;
> import org.simpleframework.xml.core.Strategy;
> import org.simpleframework.xml.graph.CycleStrategy;
>
> /**
> *
> * @author Alan Deikman
> */
> @Root public class SimpleBug {
>
> @Element protected Mojo test1;
> @Element protected Mojo test2;
>
> public SimpleBug() {
> test1 = new Mojo();
> test1.data.put("key1",
> "value");
> test2 = new Mojo();
> test2.data.put("key2",
> "value");
> }
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
>
> SimpleBug bug = null;
>
> boolean write = true;
> if (args.length > 0 &&
> args[0].equals("-r")) write = false;
>
> Strategy resolver = new
> CycleStrategy("id", "ref");
> Serializer s = new Persister(resolver);
> File file = new File("SimpleBug.xml");
>
> if (write) {
> bug = new SimpleBug();
> try {
> s.write(bug, file);
> } catch (Exception ex) {
> System.out.println("Something went
> wrong.");
> }
> }
>
> else {
> try {
> bug = s.read(SimpleBug.class, file);
> } catch (Exception ex) {
> System.out.println("Can't
> parse");
> System.out.println(ex.toString());
> }
> }
> }
>
> public static class Mojo {
> @ElementMap protected TreeMap<String, Object>
> data;
> public Mojo() {
> data = new TreeMap<String, Object>();
> }
> }
>
> }
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009,
> San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open
> Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open
> source participation
> -Receive a $600 discount off the registration fee with the
> source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H_______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Alan D. <Ala...@zn...> - 2009-02-17 23:10:18
|
Niall Gallagher wrote:
> Is this easy to reproduce? Would it be possible to write a test case to expose this problem, at least then I could fix the issue from a known reproducable test.
>
OK, I think I have test case for you in the attached file. The program
run without a command-line parameter will write the file
"SimpleBug.xml". If you run it with the command line parameter "-r" it
will try to read that file, with the exception. The exception I got was:
org.simpleframework.xml.graph.CycleException: Invalid reference '4'
found
The file it should generate (but can't read) looks like this:
<simpleBug id="0">
<test1 id="1">
<data id="2">
<entry>
<string id="3">key1</string>
<object class="java.lang.String" id="4">value</object>
</entry>
</data>
</test1>
<test2 id="5">
<data id="6">
<entry>
<string id="7">key2</string>
<object class="java.lang.String" ref="4"/>
</entry>
</data>
</test2>
</simpleBug>
Thanks again for this great class library.
--
Alan Deikman
ZNYX Networks
|
|
From: Niall G. <gal...@ya...> - 2009-02-17 20:05:50
|
Hi,
This looks strange, also have id= attributes been added manually? I've never seen this error before? Just wondering is there some other manipulation of the resulting XML. For example id="431" before id="438" looks odd.
Is this easy to reproduce? Would it be possible to write a test case to expose this problem, at least then I could fix the issue from a known reproducable test.
Thanks,
Niall
--- On Tue, 2/17/09, Alan Deikman <Ala...@zn...> wrote:
> From: Alan Deikman <Ala...@zn...>
> Subject: [Simple-support] De-serialization problem -- valid reference not valid?
> To: sim...@li...
> Date: Tuesday, February 17, 2009, 11:29 AM
> Is the following a known bug? This is using
> simple-xml-2.0.2 library.
> I recently upgraded so I don't know if this was showing
> up before.
>
> I have two instantiations of the same class, each one
> contains a map
> declared as follows:
>
> @ElementMap protected TreeMap<String, Object>
> data;
>
> Each instance has a map entry similar to a following:
>
> data.put("root/source",
> "original");
>
> When serialized, the overall XML looks good, but when I
> attempt to read
> it back in, I get an error:
>
> org.simpleframework.xml.graph.CycleException: Invalid
> reference '439' found
> at
> org.simpleframework.xml.graph.ReadGraph.getReference(ReadGraph.java:158)
> at
> org.simpleframework.xml.graph.ReadGraph.getInstance(ReadGraph.java:126)
> at
> org.simpleframework.xml.graph.ReadGraph.getElement(ReadGraph.java:107)
>
> The XML looks like this: (I edited out other entries)
>
> <data id="431">
> <entry>
> <string
> id="438">root/source</string>
> <object class="java.lang.String"
> id="439">original</object>
> </entry>
> </data>
>
> Then later in the file:
>
> <data id="723">
> <entry>
> <string ref="438"/>
> <object class="java.lang.String"
> ref="439"/>
> </entry>
> </data>
>
> If I manually take out the ref="439" and put in
> some constant, it
> de-serializes the way you would expect. My guess is the
> problem has
> something to do with the the reference is to class Object
> and not class
> java.lang.String, but the ReadGraph code that throws the
> exception is
> doing so because it came up with a null out of the
> reference map. So
> id="439" never seems to be making into the map.
> Is there a fix for this?
>
> Thanks in advance for any help.
>
> --
> Alan Deikman
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009,
> San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open
> Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open
> source participation
> -Receive a $600 discount off the registration fee with the
> source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Alan D. <Ala...@zn...> - 2009-02-17 19:46:15
|
Is the following a known bug? This is using simple-xml-2.0.2 library.
I recently upgraded so I don't know if this was showing up before.
I have two instantiations of the same class, each one contains a map
declared as follows:
@ElementMap protected TreeMap<String, Object> data;
Each instance has a map entry similar to a following:
data.put("root/source", "original");
When serialized, the overall XML looks good, but when I attempt to read
it back in, I get an error:
org.simpleframework.xml.graph.CycleException: Invalid reference '439' found
at
org.simpleframework.xml.graph.ReadGraph.getReference(ReadGraph.java:158)
at
org.simpleframework.xml.graph.ReadGraph.getInstance(ReadGraph.java:126)
at
org.simpleframework.xml.graph.ReadGraph.getElement(ReadGraph.java:107)
The XML looks like this: (I edited out other entries)
<data id="431">
<entry>
<string id="438">root/source</string>
<object class="java.lang.String" id="439">original</object>
</entry>
</data>
Then later in the file:
<data id="723">
<entry>
<string ref="438"/>
<object class="java.lang.String" ref="439"/>
</entry>
</data>
If I manually take out the ref="439" and put in some constant, it
de-serializes the way you would expect. My guess is the problem has
something to do with the the reference is to class Object and not class
java.lang.String, but the ReadGraph code that throws the exception is
doing so because it came up with a null out of the reference map. So
id="439" never seems to be making into the map. Is there a fix for this?
Thanks in advance for any help.
--
Alan Deikman
|
|
From: <Nia...@ub...> - 2009-02-17 17:58:28
|
Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company registered in England & Wales under company number 2035362, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS AG (London Branch) is registered as a branch of a foreign company under number BR004507, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS Clearing and Execution Services Limited is a company registered in England & Wales under company number 03123037, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. |
|
From: Joselito D. M. <joe...@gm...> - 2009-02-17 17:41:47
|
Hello,
Is there a way to turn off CycleStrategy for Elements that are standard java
types?
Let me explain.
Given the class definition:
@Root
public class AClass {
@Element
private BigInteger aBigInteger;
@Element
private BigInteger anotherBigInteger;
//(Setters, getters implied for this code)
}
//In the test code
public class SomeTest {
@Test
public class aTest() {
BigInteger aBigInteger = new BigInteger("0");
AClass aClass = new AClass();
aClass.setABigInteger(aBigInteger);
aClass.setAnotherBigInteger(aBigInteger);
Strategy strategy = new CycleStrategy();
Serializer serializer = new Persister(strategy);
StringWriter writer = new StringWriter();
serializer.write(aClass, writer);
System.out.println(writer.toString());
}
}
The output is:
<AClass id="0">
<aBigInteger id="1">0</aBigInteger>
<anotherBigInteger reference="1"/>
</AClass>
What I need is:
<AClass id="0">
<aBigInteger id="1">0</aBigInteger>
<anotherBigInteger id="2">0</anotherBigInteger>
</AClass>
That is, I need the second BigInteger property to be treated not as an
element reference because I want standard java data types in my beans to be
treated as different instances even though at runtime, they are pointing to
the same instance.
Could this be added as a future feature maybe?
Thanks,
Joen Moreno
|
|
From: Stanislaw O. <sta...@ca...> - 2009-02-13 14:58:08
|
> > For now its a known limitation. Collections in collections are not > supported because there is no way to decide what to call them. For instance > what would the root of the inner map be, also what would the entry elements > be named etc. Because @ElementMap contains only enough meta-data to describe > the method or field it annotates it only supports primitive and annotated > objects. > This is what I thought, thanks for confirmation. > Although NullPointerException is never good to see. Ill replace this with a > proper check and a PersistenceException. > That may save people from unnecessary debugging :-) Cheers, S. |
|
From: <Nia...@ub...> - 2009-02-13 14:19:18
|
Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company registered in England & Wales under company number 2035362, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS AG (London Branch) is registered as a branch of a foreign company under number BR004507, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS Clearing and Execution Services Limited is a company registered in England & Wales under company number 03123037, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. |
|
From: Stanislaw O. <sta...@ca...> - 2009-02-13 13:56:51
|
Hello,
I thought I'd let you know that an attempt to serialize an object of class
like this:
@Root
private static class ToSerialize
{
@ElementMap
public Map<String, Map<String, String>> map;
}
results (v2.0.2) in a NullPointerException:
Exception in thread "main" java.lang.NullPointerException
at org.simpleframework.xml.core.Support.isPrimitive(Support.java:268)
at org.simpleframework.xml.core.Source.isPrimitive(Source.java:167)
at org.simpleframework.xml.core.Entry.getValue(Entry.java:191)
at
org.simpleframework.xml.core.CompositeMap.<init>(CompositeMap.java:96)
at
org.simpleframework.xml.core.ElementMapLabel.getConverter(ElementMapLabel.java:121)
at
org.simpleframework.xml.core.CacheLabel.getConverter(CacheLabel.java:162)
at
org.simpleframework.xml.core.Composite.writeElement(Composite.java:986)
at
org.simpleframework.xml.core.Composite.writeElements(Composite.java:881)
at org.simpleframework.xml.core.Composite.write(Composite.java:787)
at org.simpleframework.xml.core.Composite.write(Composite.java:763)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:217)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:190)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:168)
at org.simpleframework.xml.core.Persister.write(Persister.java:921)
at org.simpleframework.xml.core.Persister.write(Persister.java:903)
at org.simpleframework.xml.core.Persister.write(Persister.java:884)
at org.simpleframework.xml.core.Persister.write(Persister.java:1000)
at org.simpleframework.xml.core.Persister.write(Persister.java:982)
at org.simpleframework.xml.core.Persister.write(Persister.java:963)
I'm not sure -- is this a bug or some design decision/limitation related to
generics? I'm asking more out of curiosity because I'm happy with a
workaround based on creating a wrapper class that contains a field
corresponding to the "inner" map of the problematic case.
Cheers,
Staszek
|
|
From: <Nia...@ub...> - 2009-02-11 13:50:13
|
Hi, You can do this in a few ways, the simples of which is to use a Strategy to grab the line number from the NodeMap. For convenience you could put it in to a thread local then any method invoked in your object can get the last position reference from the thread local and throw that without you having to do anything. There are examples in the test cases, look for tests with Strategy in them. Niall -----Original Message----- From: Lawrence Sewell [mailto:Law...@vt...] Sent: 10 February 2009 21:33 To: sim...@li... Subject: [Simple-support] how to determine where in the xml file/stream anexception is thrown? If I throw an exception in a "setSomething" method, how can I determine where in the XML stream the exception occurred (e.g. the StAX cursor location)? Is this info available in a Validate method? In SAX this is the Locator object and its getLineNumber() and getColumnNumber() methods. ------------------------------------------------------------------------ ------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company registered in England & Wales under company number 2035362, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS AG (London Branch) is registered as a branch of a foreign company under number BR004507, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS Clearing and Execution Services Limited is a company registered in England & Wales under company number 03123037, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. |
|
From: <Nia...@ub...> - 2009-02-11 09:51:14
|
Hi, Simplest thing to do would be to implement your own writer to scan for new lines, for each new line extracted decide how long the line should be. Then i-- until you find a space, and replace that space with a newline. For example. LineWriter out = new LineWriter(fileOut); Persiser persister = new Persister(); persister.write(myObject, out); I was intending to do something like this, configurable within the Format object. However, for now you would need to write your own, which should be a simple enough to do. Niall -----Original Message----- From: Rob Griffin [mailto:rob...@qu...] Sent: 10 February 2009 22:13 To: Simple Subject: [Simple-support] XML formatting for attribute lists Hello, Is there any way to control how the XML is written so that the attribute list of an element is wrapped after it reaches a certain length? I often have to look at the XML and find it difficult to read where there are a lot of attributes. Regards, Rob Griffin Quest Software www.quest.com ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company registered in England & Wales under company number 2035362, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS AG (London Branch) is registered as a branch of a foreign company under number BR004507, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS Clearing and Execution Services Limited is a company registered in England & Wales under company number 03123037, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. |
|
From: Lawrence S. <Law...@vt...> - 2009-02-11 00:59:41
|
If I throw an exception in a "setSomething" method, how can I determine where in the XML stream the exception occurred (e.g. the StAX cursor location)? Is this info available in a Validate method? In SAX this is the Locator object and its getLineNumber() and getColumnNumber() methods. |
|
From: Rob G. <rob...@qu...> - 2009-02-10 23:00:00
|
Hello, Is there any way to control how the XML is written so that the attribute list of an element is wrapped after it reaches a certain length? I often have to look at the XML and find it difficult to read where there are a lot of attributes. Regards, Rob Griffin Quest Software www.quest.com |
|
From: Niall G. <gal...@ya...> - 2009-01-29 18:14:59
|
Hi,
They do the exact same thing. I did not make DefaultStrategy public for a number of reasons. For one I hate "Default" objects and for another I wanted to have stock strategy types in a single location, without any package cycles. So you can use TreeStrategy to get the exact same functionality as DefaultStrategy.
Niall
--- On Thu, 1/29/09, Kevin Day <for...@tr...> wrote:
> From: Kevin Day <for...@tr...>
> Subject: [Simple-support] Difference between DefaultStrategy and TreeStrategy?
> To: "Simple" <sim...@li...>
> Date: Thursday, January 29, 2009, 9:51 AM
> <div id=yiv201421765><!DOCTYPE HTML PUBLIC
> "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html><head>
> <style type="text/css">#yiv201421765 P,
> #yiv201421765 UL, #yiv201421765 OL, #yiv201421765 DL,
> #yiv201421765 DIR, #yiv201421765 MENU, #yiv201421765 PRE
> {margin:0 auto;}</style>
>
> </head>
> <font face="Arial" size="2">
> <div>Just curious if there is any functional
> difference between these two. The source has some
> slight differences, but they seem like they are doing pretty
> much the same thing.</div>
> <div> </div>
> <div>Thanks!</div>
> <div> </div>
> <div>- K</div>
> <div> </div>
> <div> </div>
> <div></div>
> <div> </div></font></html>
>
> </div>------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword_______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|