poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23075] - NegativeArraySizeException
Date Thu, 11 Sep 2003 17:50:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23075>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23075

NegativeArraySizeException

izelaya@proyectopaar.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From izelaya@proyectopaar.org  2003-09-11 17:50 -------
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;
            }

Hope this can help you guys for future releases.  Thanks,
 
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


Mime
View raw message