harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@apache.org>
Subject Re: [classlib] [luni] Should Improve File System Exception Messages
Date Wed, 10 Dec 2008 11:48:17 GMT
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: 


View raw message