Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

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

Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Ray-91
Hi Adrian,

Wouldn't this still leave a stream open? I'm guessing you meant to pass
the new stream 'is' in to the readXMLDocument method as the first
argument rather than leave the url.openStream() call in there.

Ray


[hidden email] wrote:

> Author: adrianc
> Date: Wed May 20 05:29:52 2009
> New Revision: 776563
>
> URL: http://svn.apache.org/viewvc?rev=776563&view=rev
> Log:
> Closed an InputStream that was left open.
>
> Modified:
>     ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>
> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=776563&r1=776562&r2=776563&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Wed May 20 05:29:52 2009
> @@ -348,9 +348,13 @@
>              Debug.logWarning("[UtilXml.readXmlDocument] URL was null, doing nothing", module);
>              return null;
>          }
> -        return readXmlDocument(url.openStream(), validate, url.toString());
> +        InputStream is = url.openStream();
> +        Document document = readXmlDocument(url.openStream(), validate, url.toString());
> +        is.close();
> +        return document;
>      }
>  
> +
>      /**
>       * @deprecated
>       */
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Adrian Crum-2

Oops. You're right. Thanks for pointing that out Ray!

That's what happens when I commit right before going to bed.

-Adrian

--- On Wed, 5/20/09, Ray <[hidden email]> wrote:

> From: Ray <[hidden email]>
> Subject: Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> To: [hidden email]
> Date: Wednesday, May 20, 2009, 2:29 AM
> Hi Adrian,
>
> Wouldn't this still leave a stream open? I'm guessing you
> meant to pass the new stream 'is' in to the readXMLDocument
> method as the first argument rather than leave the
> url.openStream() call in there.
>
> Ray
>
>
> [hidden email]
> wrote:
> > Author: adrianc
> > Date: Wed May 20 05:29:52 2009
> > New Revision: 776563
> >
> > URL: http://svn.apache.org/viewvc?rev=776563&view=rev
> > Log:
> > Closed an InputStream that was left open.
> >
> > Modified:
> > 
>    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> >
> > Modified:
> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=776563&r1=776562&r2=776563&view=diff
> >
> ==============================================================================
> > ---
> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> (original)
> > +++
> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> Wed May 20 05:29:52 2009
> > @@ -348,9 +348,13 @@
> >             
> Debug.logWarning("[UtilXml.readXmlDocument] URL was null,
> doing nothing", module);
> >              return
> null;
> >          }
> > -        return
> readXmlDocument(url.openStream(), validate,
> url.toString());
> > +        InputStream is =
> url.openStream();
> > +        Document document =
> readXmlDocument(url.openStream(), validate,
> url.toString());
> > +        is.close();
> > +        return document;
> >      }
> >  +
> >      /**
> >       * @deprecated
> >       */
> >
> >
> >
>



Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

David E Jones-3

Sorry, didn't see this thread before committing a fix... it's done in  
rev 776726.

-David


On May 20, 2009, at 7:05 AM, Adrian Crum wrote:

>
> Oops. You're right. Thanks for pointing that out Ray!
>
> That's what happens when I commit right before going to bed.
>
> -Adrian
>
> --- On Wed, 5/20/09, Ray <[hidden email]> wrote:
>
>> From: Ray <[hidden email]>
>> Subject: Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/
>> org/ofbiz/base/util/UtilXml.java
>> To: [hidden email]
>> Date: Wednesday, May 20, 2009, 2:29 AM
>> Hi Adrian,
>>
>> Wouldn't this still leave a stream open? I'm guessing you
>> meant to pass the new stream 'is' in to the readXMLDocument
>> method as the first argument rather than leave the
>> url.openStream() call in there.
>>
>> Ray
>>
>>
>> [hidden email]
>> wrote:
>>> Author: adrianc
>>> Date: Wed May 20 05:29:52 2009
>>> New Revision: 776563
>>>
>>> URL: http://svn.apache.org/viewvc?rev=776563&view=rev
>>> Log:
>>> Closed an InputStream that was left open.
>>>
>>> Modified:
>>>
>>    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>
>>> Modified:
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=776563&r1=776562&r2=776563&view=diff
>>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>>> ---
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> (original)
>>> +++
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> Wed May 20 05:29:52 2009
>>> @@ -348,9 +348,13 @@
>>>
>> Debug.logWarning("[UtilXml.readXmlDocument] URL was null,
>> doing nothing", module);
>>>               return
>> null;
>>>           }
>>> -        return
>> readXmlDocument(url.openStream(), validate,
>> url.toString());
>>> +        InputStream is =
>> url.openStream();
>>> +        Document document =
>> readXmlDocument(url.openStream(), validate,
>> url.toString());
>>> +        is.close();
>>> +        return document;
>>>       }
>>>   +
>>>       /**
>>>        * @deprecated
>>>        */
>>>
>>>
>>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r776563 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Adrian Crum
Thanks David! I was getting ready to commit it myself.

-Adrian

David E Jones wrote:

>
> Sorry, didn't see this thread before committing a fix... it's done in
> rev 776726.
>
> -David
>
>
> On May 20, 2009, at 7:05 AM, Adrian Crum wrote:
>
>>
>> Oops. You're right. Thanks for pointing that out Ray!
>>
>> That's what happens when I commit right before going to bed.
>>
>> -Adrian
>>
>> --- On Wed, 5/20/09, Ray <[hidden email]> wrote:
>>
>>> From: Ray <[hidden email]>
>>> Subject: Re: svn commit: r776563 -
>>> /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> To: [hidden email]
>>> Date: Wednesday, May 20, 2009, 2:29 AM
>>> Hi Adrian,
>>>
>>> Wouldn't this still leave a stream open? I'm guessing you
>>> meant to pass the new stream 'is' in to the readXMLDocument
>>> method as the first argument rather than leave the
>>> url.openStream() call in there.
>>>
>>> Ray
>>>
>>>
>>> [hidden email]
>>> wrote:
>>>> Author: adrianc
>>>> Date: Wed May 20 05:29:52 2009
>>>> New Revision: 776563
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=776563&view=rev
>>>> Log:
>>>> Closed an InputStream that was left open.
>>>>
>>>> Modified:
>>>>
>>>    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>
>>>> Modified:
>>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=776563&r1=776562&r2=776563&view=diff 
>>>>
>>>>
>>> ==============================================================================
>>>
>>>> ---
>>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> (original)
>>>> +++
>>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> Wed May 20 05:29:52 2009
>>>> @@ -348,9 +348,13 @@
>>>>
>>> Debug.logWarning("[UtilXml.readXmlDocument] URL was null,
>>> doing nothing", module);
>>>>               return
>>> null;
>>>>           }
>>>> -        return
>>> readXmlDocument(url.openStream(), validate,
>>> url.toString());
>>>> +        InputStream is =
>>> url.openStream();
>>>> +        Document document =
>>> readXmlDocument(url.openStream(), validate,
>>> url.toString());
>>>> +        is.close();
>>>> +        return document;
>>>>       }
>>>>   +
>>>>       /**
>>>>        * @deprecated
>>>>        */
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
>