Re: [Simple-support] Bug in Persister
Brought to you by:
niallg
|
From: Marco V. <ve...@zh...> - 2007-06-12 11:19:09
|
Ok, thanks a lot for your work.
Niall Gallagher wrote:
> I agree, Ill make sure this is fixed in the next release....
>
> ----- Original Message ----
> From: Federico Fissore <fed...@fi...>
> To: sim...@li...
> Sent: Tuesday, June 12, 2007 12:05:24 PM
> Subject: Re: [Simple-support] Bug in Persister
>
> Marco Vergari ha scritto:
>> public <T> T read(Class<? extends T> type, File source) throws Exception {
>> FileInputStream fis = new FileInputStream(source); // Patch: Close the
>> FileInputStream
>> try {
>> return (T)read(type, fis);
>> } finally {
>> fis.close();
>> }
>> }
>>
>>
> uhhm... IMHO the method should work with the object without changing its
> state. That said, read methods that use "raw" inputstream and reader
> should leave that stream/reader the way they received it, avoinding to
> close it
>
> Instead, read methods that accept String and File should close it, as
> they created and opened the corresponding stream/reader
|