[7.7.1] Filename>>fileIn leaves file streams open

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[7.7.1] Filename>>fileIn leaves file streams open

Boris Popov, DeepCove Labs (SNN)

Original,

 

Filename>>fileIn

Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in from:'); crtab; show: self asString.

^(self withEncoding: #Source) readStream fileIn

 

Should be,

 

Filename>>fileIn

| rs |

Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in from:'); crtab; show: self asString.

rs := (self withEncoding: #Source) readStream.

^[rs fileIn] ensure: [rs close]

 

-Boris

 

--

DeepCove Labs Ltd.

+1 (604) 689-0322

4th floor, 595 Howe Street

Vancouver, British Columbia

Canada V6C 2T5

http://tinyurl.com/r7uw4

 

PacNet Services (Europe) Ltd.

+353 (0)61 714-360

Shannon Airport House, SFZ

County Clare, Ireland

http://tinyurl.com/y952amr

 

CONFIDENTIALITY NOTICE

 

This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments.

 

Thank you.

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [7.7.1] Filename>>fileIn leaves file streams open

Niall Ross
Dear Boris,
    AFAICT #fileIn calls

    ^(SourceFileFormat formatForStream: self)
        fileInFrom: self

and for all subclasses in SourceFileFormat (both in base VW and if
FileOut30 is loaded) close is ensured, directly in
ChunckFileFormat>>fileIn and indirectly in XMLParser>>parseElements
where it closes naturally if it completes and there is an
    ifCurtailed: [self closeAllFiles]
in case it does not.

I tested in the current 7.8 build but I assume 7.7.1 has the same behaviour.

          Yours faithfully
                Niall Ross

>Original,
>
>
>
>Filename>>fileIn
>
>Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in
>from:'); crtab; show: self asString.
>
>^(self withEncoding: #Source) readStream fileIn
>
>
>
>Should be,
>
>
>
>Filename>>fileIn
>
>| rs |
>
>Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in
>from:'); crtab; show: self asString.
>
>rs := (self withEncoding: #Source) readStream.
>
>^[rs fileIn] ensure: [rs close]
>
>
>
>-Boris
>
>
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [7.7.1] Filename>>fileIn leaves file streams open

Boris Popov, DeepCove Labs (SNN)
Niall,

Thanks, it must be something else then. Still, if you were looking for
suggestions, a better pattern would be to close the stream in the same
place that opened it.

-Boris

--
DeepCove Labs Ltd.
+1 (604) 689-0322
4th floor, 595 Howe Street
Vancouver, British Columbia
Canada V6C 2T5
http://tinyurl.com/r7uw4

PacNet Services (Europe) Ltd.
+353 (0)61 714-360
Shannon Airport House, SFZ
County Clare, Ireland
http://tinyurl.com/y952amr

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.


-----Original Message-----
From: Niall Ross [mailto:[hidden email]]
Sent: 20 January 2011 13:40
To: Boris Popov, DeepCove Labs
Cc: vwnc List
Subject: Re: [vwnc] [7.7.1] Filename>>fileIn leaves file streams open

Dear Boris,
    AFAICT #fileIn calls

    ^(SourceFileFormat formatForStream: self)
        fileInFrom: self

and for all subclasses in SourceFileFormat (both in base VW and if
FileOut30 is loaded) close is ensured, directly in
ChunckFileFormat>>fileIn and indirectly in XMLParser>>parseElements
where it closes naturally if it completes and there is an
    ifCurtailed: [self closeAllFiles]
in case it does not.

I tested in the current 7.8 build but I assume 7.7.1 has the same
behaviour.

          Yours faithfully
                Niall Ross

>Original,
>
>
>
>Filename>>fileIn
>
>Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in
>from:'); crtab; show: self asString.
>
>^(self withEncoding: #Source) readStream fileIn
>
>
>
>Should be,
>
>
>
>Filename>>fileIn
>
>| rs |
>
>Transcript cr; show: (#FilingInFromColon << #dialogs >> 'Filing in
>from:'); crtab; show: self asString.
>
>rs := (self withEncoding: #Source) readStream.
>
>^[rs fileIn] ensure: [rs close]
>
>
>
>-Boris
>
>
>
>  
>
>-----------------------------------------------------------------------
>-
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc