The attached patch to SimpleDOWriter seems to fix the problem for me (on Linux 
and Windows). It is not a patch ready to be adopted by Fedora; it has not been 
tested much and only used in one, rather specific scenario and thus may fail in 
others; but I hope it points in the right direction.

carsten

From: Friedrich, Carsten (ICT Centre, Acton)
Sent: Monday, 7 September 2009 10:45
To: Friedrich, Carsten (ICT Centre, Acton); Steve Bayliss; 
[email protected]
Subject: RE: [Fedora-commons-developers] Problem adding literal 
relationshipcontainng non-ascii characters

Second try. The first one was rejected due to being too large. I removed 
fedora-client.jar + dependent libraries from the zip file. Please add them 
yourself from the Fedora 3.2 distro.

Carsten

From: Friedrich, Carsten (ICT Centre, Acton)
Sent: Monday, 7 September 2009 10:02
To: 'Steve Bayliss'; [email protected]
Subject: RE: [Fedora-commons-developers] Problem adding literal 
relationshipcontainng non-ascii characters

I use the API from fedora-client.jar (v 3.2)against a 3.2 server. Linux uses 
UTF-8 and Windows cp-1252.

Example attached as an Eclipse project. You will need to modify the first line 
to point to your server address, login, and password.

Cheers,
Carsten

From: Steve Bayliss [mailto:[email protected]]
Sent: Friday, 4 September 2009 17:52
To: Friedrich, Carsten (ICT Centre, Acton); 
[email protected]
Subject: RE: [Fedora-commons-developers] Problem adding literal 
relationshipcontainng non-ascii characters

Hi Carsten

Looks like there is an issue here - how are you adding the relationship?  Do 
you have some sample code so we can reproduce this?

Also, do you have the platform character encoding for the Windows and Linux 
platforms you are using?  If you are able to output Charset.defaultCharset() 
for both and let us know these that would also help.

Thanks
Steve


-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 04 September 2009 05:00
To: [email protected]
Subject: [Fedora-commons-developers] Problem adding literal 
relationshipcontainng non-ascii characters
Hi,

I try to add a literal relationship with the object below to a fedora object. 
If running fedora on windows this throws an exception about invalid UTF-8 
characters in ValidationUtility.validateReservedDatastream, and on linux it 
succeeds but the relationship string gets corrupted. I noticed two suspicious 
lines in the Fedora source code in SimpleDOWriter#addRelationship:
String xmlContent = new String(out.toByteArray());
And
                newds.xmlContent = xmlContent.getBytes();
which both do seem to ignore the character set of the String.

The relationship object I want to add:

Apis mellifera capensis and Apis mellifera scutellata are very difficult to 
separate on morphological grounds - the best method seems to be to identify the 
geographical location of the source of the population.  Apis mellifera capensis 
is generally confined to the south west corner of South Africa and along the 
southern coast to Port Elizabeth; Apis mellifera scutellata can be found 
throughout most of the remaining areas of South Africa (See Figure 5 in Hepburn 
and Radloff in Weblinks)

 There appears to be three subspecies of Apis mellifera in South Africa -  A. 
m. capensis, A. m. scutellata and an unnamed "mountain form" (Hepburn & Radloff 
2002).

Workers of A. m. capensis have on average more than 5 ovarioles/ovaries and a 
spermathecal diameter of 0.30mm; the spermathecas of workers of other species 
of Apis are vestigial.

Apis mellifera capensis workers can invade the nests of African bee A. m. 
scutellata, parasitise these colonies, causing colony death.

The same relationship object retrieved back from fedora (on linux, not possible 
on Windows as fedora throws exception when adding):

Apis mellifera capensis and Apis mellifera scutellata are very difficult to 
separate on morphological grounds ??? the best method seems to be to identify 
the geographical location of the source of the population.  Apis mellifera 
capensis is generally confined to the south west corner of South Africa and 
along the southern coast to Port Elizabeth; Apis mellifera scutellata can be 
found throughout most of the remaining areas of South Africa (See Figure 5 in 
Hepburn and Radloff in Weblinks)

 There appears to be three subspecies of Apis mellifera in South Africa -  A. 
m. capensis, A. m. scutellata and an unnamed ???mountain form??? (Hepburn & 
Radloff 2002).

Workers of A. m. capensis have on average more than 5 ovarioles/ovaries and a 
spermathecal diameter of 0.30mm; the spermathecas of workers of other species 
of Apis are vestigial.

Apis mellifera capensis workers can invade the nests of African bee A. m. 
scutellata, parasitise these colonies, causing colony death.

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.76/2344 - Release Date: 09/03/09 
18:05:00

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.76/2344 - Release Date: 09/03/09 
18:05:00

Attachment: SimpleDOWriter.java.patch
Description: SimpleDOWriter.java.patch

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fedora-commons-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-developers

Reply via email to