Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-11826

Replace try-finally with try with resources

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • Trunk
    • None
    • ALL COMPONENTS
    • None

    Description

      Support for try-with-resources – introduced in Java 7 – allows us to declare resources to be used in a try block with the assurance that the resources will be closed when after the execution of that block.

      To do so, you must open and use the resource within a Java try-with-resources block. When the execution leaves the try-with-resources block, any resource opened within the try-with-resources block is automatically closed, regardless of whether any exceptions are thrown either from inside the try-with-resources block, or when attempting to close the resources.

       

      Attachments

        1. OFBIZ-11826-plugins.patch
          3 kB
          Pawan Verma
        2. OFBIZ-11826.patch
          5 kB
          Pawan Verma

        Issue Links

          Activity

            Hi Pawan,

            Sometimes ago I created OFBIZ-11336 for the same in Groovy.

            jleroux Jacques Le Roux added a comment - Hi Pawan, Sometimes ago I created OFBIZ-11336 for the same in Groovy.
            pawan Pawan Verma added a comment -

            Attached patch for the improvement.

            jleroux Thanks for the link, will have a look. 

            pawan Pawan Verma added a comment - Attached patch for the improvement. jleroux  Thanks for the link, will have a look. 

            Thanks Pawan,

            Both patch look good to me (disclaimer did not compile only reviewed, but no doubts), +1 for commit

            jleroux Jacques Le Roux added a comment - Thanks Pawan, Both patch look good to me (disclaimer did not compile only reviewed, but no doubts), +1 for commit

            Commit 2a4a617d0d63dd288cca5dd1f657c16d83d36240 in ofbiz-framework's branch refs/heads/trunk from Pawan Verma
            [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=2a4a617 ]

            Improved: Replace try-finally with try with resources(OFBIZ-11826)

            Set checkstyleMain.maxErrors to 26678 (-4)

            Thanks: Jacques for the review.

            jira-bot ASF subversion and git services added a comment - Commit 2a4a617d0d63dd288cca5dd1f657c16d83d36240 in ofbiz-framework's branch refs/heads/trunk from Pawan Verma [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=2a4a617 ] Improved: Replace try-finally with try with resources( OFBIZ-11826 ) Set checkstyleMain.maxErrors to 26678 (-4) Thanks: Jacques for the review.

            Commit 32f3e468da726c056c8bd84bad6070c6847e504a in ofbiz-plugins's branch refs/heads/trunk from Pawan Verma
            [ https://gitbox.apache.org/repos/asf?p=ofbiz-plugins.git;h=32f3e46 ]

            Improved: Replace try-finally with try with resources(OFBIZ-11826)

            Set checkstyleMain.maxErrors to 26678 (-4)

            Thanks: Jacques for the review.

            jira-bot ASF subversion and git services added a comment - Commit 32f3e468da726c056c8bd84bad6070c6847e504a in ofbiz-plugins's branch refs/heads/trunk from Pawan Verma [ https://gitbox.apache.org/repos/asf?p=ofbiz-plugins.git;h=32f3e46 ] Improved: Replace try-finally with try with resources( OFBIZ-11826 ) Set checkstyleMain.maxErrors to 26678 (-4) Thanks: Jacques for the review.

            People

              pawan Pawan Verma
              pawan Pawan Verma
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: