Re: [Simple-support] Bug in Persister
Brought to you by:
niallg
|
From: Marco V. <ve...@zh...> - 2007-06-12 11:17:03
|
You have right the method should work with the object without changing
its state. Only the following methods should close their created streams
and readers:
- public <T> T read(Class<? extends T> type, String source) throws Exception
- public <T> T read(Class<? extends T> type, File source) throws Exception {
- public void write(Object source, File out) throws Exception {
Federico Fissore wrote:
> 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
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|