[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slide-dev
Subject:    STOP: NodeRevisionContent bug and patch
From:       Oliver Zeigermann <ozeigermann () c1-fse ! de>
Date:       2003-10-27 10:00:01
[Download RAW message or body]

STOP!

I am an evil copy paste programmer and have replaced one line too much 
in the patch.

Sorry for this, the valid patch is attached now.

Oliver

Oliver Zeigermann wrote:
> Hi,
> 
> when reading internally from a stream to fill contentBytes or content in 
> getContent() and getContentBytes() the input stream gets nulled 
> afterwards, but not closed.
> 
> Patch is attached.
> 
> Oliver
> 
> 
> ------------------------------------------------------------------------
> 
> Index: NodeRevisionContent.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java,v
> retrieving revision 1.12
> diff -u -w -r1.12 NodeRevisionContent.java
> --- NodeRevisionContent.java	7 Apr 2003 11:45:42 -0000	1.12
> +++ NodeRevisionContent.java	24 Oct 2003 12:00:29 -0000
> @@ -151,6 +151,11 @@
>                  contentBytes = read(inputStream);
>              } catch (IOException e) {
>                  e.printStackTrace();
> +            } finally {
> +                try {
> +                    inputStream.close();
> +                } catch (IOException e) {
> +                }
>              }
>              content = new String(contentBytes).toCharArray();
>              result = content;
> @@ -177,8 +182,12 @@
>                  contentBytes = read(inputStream);
>              } catch (IOException e) {
>                  e.printStackTrace();
> +            } finally {
> +                try {
> +                    inputStream.close();
> +                } catch (IOException e) {
> +                }
>              }
> -            result = contentBytes;
>              inputStream = null;
>              reader = null;
>          }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org


["patch.diff" (text/plain)]

Index: NodeRevisionContent.java
===================================================================
RCS file: /home/cvspublic/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java,v
retrieving revision 1.12
diff -u -w -r1.12 NodeRevisionContent.java
--- NodeRevisionContent.java	7 Apr 2003 11:45:42 -0000	1.12
+++ NodeRevisionContent.java	27 Oct 2003 10:02:33 -0000
@@ -151,6 +151,11 @@
                 contentBytes = read(inputStream);
             } catch (IOException e) {
                 e.printStackTrace();
+            } finally {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                }
             }
             content = new String(contentBytes).toCharArray();
             result = content;
@@ -177,6 +182,11 @@
                 contentBytes = read(inputStream);
             } catch (IOException e) {
                 e.printStackTrace();
+            } finally {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                }
             }
             result = contentBytes;
             inputStream = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic