harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Regis <xu.re...@gmail.com>
Subject Re: [classlib] [luni] Should Improve File System Exception Messages
Date Wed, 10 Dec 2008 12:18:43 GMT

Gregory Shimansky wrote:
> Regis said the following on 10.12.2008 7:46:
>>
>>
>> Tim Ellison wrote:
>>> Regis wrote:
>>>> I have attached a patch for this issue on JIRA.
>>>
>>> See comments elsewhere why the patch needs some tweaking.
>>>
>>>> I think that would be helpful to add file path in error messages when
>>>> throw FileNotFoundException, and that need to allocate new memory for
>>>> the new messages, I used hymem_allocate_memory to do this. But I don't
>>>> have chance to free that memory, since exception thrown, code back to
>>>> java. That may cause memory leak, I know define a enough large char
>>>> array could avoid this, but need more memory (path may be very 
>>>> long), is
>>>> there any other better way to do this? Thanks!
>>>
>>> A code sample would be helpful to ensure I understand your situation
>>> correctly.
>> For example, the system message is "No such file or directory", I just 
>> like to append file path, like "No such file or directory: /home/a/c", 
>> so I need a new block of memory for holding the new string.
>>>
>>> But the 'throw' in native code does not cause a function return (think
>>> of it as marking a pending throw upon return [1]).  The ThrowNew JNI
>>> call will copy the message string into a new Java String object, so you
>>> can free it before the native returns, i.e.
>> That's a little surprise, I need to refresh my head about the native 
>> code. Where can I find such details of JNI call? It seems JNI spec is 
>> so brief that I can't find more useful things.
> 
> There is a "book" from Sun that is more detailed than JNI spec: 
> http://java.sun.com/docs/books/jni/html/jniTOC.html
> 
Great, thanks Gregory!

-- 
Best Regards,
Regis.

Mime
View raw message