Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42542

SCMHeadObserver.observe(SCMHead,SCMRevision) should be allowed to throw IO and Interrupted exceptions

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Almost all functional implementations of SCMHeadObserver.observe(SCMHead,SCMRevision) perform either blocking operations or operations that involve I/O. In the absence of being able to throw either IOException or InterruptedException they have no way to expose their failure to the calling SCMSource.fetch(...) operation and hence no way to propagate out to the consumer code.

      This is strictly speaking a breaking method signature change, the following is the rationale as to why we can make the change with minimal risk:

      • consumers of SCM API will be implementing their own subclasses of SCMHeadObserver, they will not (outside of unit tests) be calling SCMHeadObserver.observe() thus the widening of the method signature will not affect consumers.
      • SCMSource.fetch(...) (and it's matching SPI, SCMSource.retrieve(...)) already declare throwing IOException and InterruptedException so implementations of SCM API should not be affected by the signature change. At worst implementations will pick up a compiler error when they update their SCM API dependency - though a quick test revealed that git, mercurial, github and Bitbucket SCMSource implementations were all unaffected by the change.
      • Running a newer SCM API with an implementation that were compiled against the older SCM API will not cause issues as:
        • Checked exceptions are not enforced at runtime, only at compile time.
        • The calls to SCMHeadObserver.observe(...) will all be within  SCMSource.retrieve(...) which already propagates the same exceptions so consumers will be handling the exceptions anyway. 

       

        Attachments

          Issue Links

            Activity

            stephenconnolly Stephen Connolly created issue -
            stephenconnolly Stephen Connolly made changes -
            Field Original Value New Value
            Labels scm-api-tidy
            stephenconnolly Stephen Connolly made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            stephenconnolly Stephen Connolly made changes -
            Remote Link This issue links to "PR#33 (Web Link)" [ 15618 ]
            stephenconnolly Stephen Connolly made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            stephenconnolly Stephen Connolly made changes -
            Link This issue is blocking JENKINS-42511 [ JENKINS-42511 ]
            stephenconnolly Stephen Connolly made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            stephenconnolly Stephen Connolly made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              Assignee:
              stephenconnolly Stephen Connolly
              Reporter:
              stephenconnolly Stephen Connolly
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: