You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Igor Zelaya <iz...@proyectopaar.org> on 2003/09/11 19:42:23 UTC
Update on Bug # 23075
hi:
For HPFS to interpret microsoft's property set correctly, including multilingual support(only tried spanish tildes) I changed the 'value' variable assigmet in the following code:
case Variant.VT_LPSTR:
case Variant.VT_LPWSTR:
{
/* Read a byte string. In Java it is represented as a
String. The null bytes at the end of the byte
strings must be stripped. */
final int first = o + DWord.LENGTH;
int last = first + new DWord(src, o).intValue() - 1;
o += DWord.LENGTH;
/* while (src[last] == 0 && first <= last)
last--;*/
try{
/*value = new String(src, first, last - first + 1);*/
value = new String((new String(src, first, last - first + 1, "UTF-16LE")).getBytes(),"UTF-8");
}
catch(java.io.UnsupportedEncodingException ex){
}
break;
}
To solve the NegativeArraySizeException I added an if-statement in the following code:
default:
{
if (length > 0){
final byte[] v = new byte[length];
for (int i = 0; i < length; i++)
v[i] = src[offset + i];
value = v;
}
else
value = null;
break;
}
This codi is located in the Property constructor. Hope this can help you guys for future releases. Thanks again,
Igor L. Zelaya
Senior Software Developer
Proyecto PAAR
Possible Bug HSSFSheet.getRow(row)
Posted by Eric Pugh <ep...@upstate.com>.
Hi all,
I am trying to finish cleanup my testcase for the contrib HSSFCellUtil to
submit, and they are failing due to this call:
HSSFRow row = sheet.getRow( (short) rowCounter );. If the row doesn't
exist, then I get an exception. However, according to the spec, if
the row doesn't exist, then it should return null. It fails because
HSSFSheet.getRow() calls
HSSFRow retval = new HSSFRow(book, sheet, this.sheet.getRow(rownum));
But, the sheet doesn't have a row because it hasn't been created!
Is this a bug, or am I misunderstanding something. This is with CVS head.
I want to get my contrib testcases in because a user of
HSSFCellUtil thinks he may have found a bug, and I want him to supply a
testcase proving it.
Eric Pugh
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org
Re: Update on Bug # 23075
Posted by "A. Rothman" <am...@amichais.net>.
value = new String((new String(src, first, last - first + 1,
"UTF-16LE")).getBytes(),"UTF-8");
this looks fishy...first of all the no-arg getBytes() uses a
system-dependant codepage, which means results may vary on different
machines, and second taking the bytes and reconstructing back to a string
seems to accomplish nothing (in the case both encodings are identical) or
damage the data (if the encodings are different and incompatible with the
data at hand). looks like the UTF16 part alone should do the job.
BTW, for standard ASCII chars, ASCII, ISO-Latin-1, and UTF8 bytes will be
represented identically, and will also look the same as the lower bytes of
UTF16/UCS2/Unicode 16-bit characters. This is why code often works ok for
english (ASCII), but then fails when foreign character sets are introduced.
----- Original Message -----
From: "Igor Zelaya" <iz...@proyectopaar.org>
To: <po...@jakarta.apache.org>
Sent: Thursday, September 11, 2003 7:42 PM
Subject: Update on Bug # 23075
> hi:
>
> For HPFS to interpret microsoft's property set correctly, including
multilingual support(only tried spanish tildes) I changed the 'value'
variable assigmet in the following code:
>
> case Variant.VT_LPSTR:
> case Variant.VT_LPWSTR:
> {
> /* Read a byte string. In Java it is represented as a
> String. The null bytes at the end of the byte
> strings must be stripped. */
> final int first = o + DWord.LENGTH;
> int last = first + new DWord(src, o).intValue() - 1;
> o += DWord.LENGTH;
> /* while (src[last] == 0 && first <= last)
> last--;*/
> try{
> /*value = new String(src, first, last - first + 1);*/
> value = new String((new String(src, first, last - first
+ 1, "UTF-16LE")).getBytes(),"UTF-8");
> }
> catch(java.io.UnsupportedEncodingException ex){
> }
> break;
> }
>
> To solve the NegativeArraySizeException I added an if-statement in the
following code:
>
> default:
> {
> if (length > 0){
> final byte[] v = new byte[length];
> for (int i = 0; i < length; i++)
> v[i] = src[offset + i];
> value = v;
> }
> else
> value = null;
> break;
> }
>
> This codi is located in the Property constructor. Hope this can help you
guys for future releases. Thanks again,
>
>
>
> Igor L. Zelaya
> Senior Software Developer
> Proyecto PAAR
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org