lwuit
  1. lwuit
  2. LWUIT-443

com.sun.lwuit.io.util.BufferedOutputStream.close() potential for open stream

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      It looks to me that the com.sun.lwuit.io.util.BufferedOutputStream.close() method could potentially leave the wrapped stream open if the flush() fails and throws an exception. There is probably no problem for JavaME environments where the connection object is attached amd later closed in the cleanup, but for other streams without attachment this can be problematic. The following patch should be a possible fix.

      # This patch file was generated by NetBeans IDE
      # It uses platform neutral UTF-8 encoding and \n newlines.
      --- Base (BASE)
      +++ Locally Modified (Based On LOCAL)
      @@ -287,9 +287,13 @@
                   IOImplementation.getInstance().logStreamClose(name, false, streamCount);
                   try {
                       flush();
      -                out.close();
                   } catch (Exception ignored) {
      +            } finally {
      +                try{
      +                    out.close();
      +                } catch (Exception ignored){
                   }
      +            }
                   if(connection != null) {
                       IOImplementation.getInstance().cleanup(connection);
                   }
      
      

        Activity

        Hide
        vprise added a comment -

        Fixed in SVN

        Show
        vprise added a comment - Fixed in SVN

          People

          • Assignee:
            Unassigned
            Reporter:
            thorsten_s
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: