Groovy
  1. Groovy
  2. GROOVY-3921

Add connection configuration options to URL.getText(), URL.newInputStream() and URL.newReader()

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.1
    • Component/s: groovy-jdk
    • Labels:
      None
    • Flags:
      Patch

      Description

      There was a question on StackOverflow about how to set a timeout for URL.text

      http://stackoverflow.com/questions/1839435/setting-timeout-for-new-url-text-in-groovy-grails

      I have attached a patch which allows you to do:

      def s = new URL( 'http://www.google.com' ).getText( 10 )

      (which will give you a 10 millisecond timeout on both the connection and read – and return null if this timeout fires)

      No Tests Supplied

      I have no idea how you would test this in a non-contrived way, I have looked around for a URL.text test and it seems that I would need to mock the URL class, but I can't think how to do the timeout testing with this object

      Hope it's ok...

        Issue Links

          Activity

          Tim Yates created issue -
          Cédric Champeau made changes -
          Field Original Value New Value
          Assignee Cedric Champeau [ melix ]
          Cédric Champeau made changes -
          Summary Add a Timeout to URL.text Add connection configuration options to URL.getText(), URL.newInputStream() and URL.newReader()
          Cédric Champeau made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.8.1 [ 17223 ]
          Paul King made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12732883 ] Default workflow, editable Closed status [ 12744583 ]
          Mark Thomas made changes -
          Flags Patch [ 10430 ]
          Patch Submitted Yes [ 10763 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12970503 ] Default workflow, editable Closed status [ 12978279 ]
          Michael Fairfield made changes -
          Link This issue relates to GROOVY-7425 [ GROOVY-7425 ]

            People

            • Assignee:
              Cédric Champeau
              Reporter:
              Tim Yates
            • Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development