SideBySide2: Fix failure to load from "ISE EditIterator out of bounds"

Intraline edit information can include a negative delta on the B
side of an edit, for example:

  {
    a: [...],
    b: [...],
    edit_a: [[4, 11], [14, 12]]
    edit_b: [[4, 66], [37, 41], [-2, 1]]
  }

In the edit_a or edit_b block the list pairs are the number of
characters to advance since the last position. -2 encodes the edit
iterator has to go back 2 positions to return the correct value.

This situation arose from an intraline edit list of:

  REPLACE( 4-15,  4- 70),
  REPLACE(29-41,107-148),
  INSERT (62-62,146-147)

The EditList is sorted by the beginA values, where 29 < 62. This
forced the final INSERT to sort in the edit_b list after the REPLACE
at 107. Since 146 < 148 the final edit_b entry was encoded with a
negative delta (148 - 146 = -2).

Update the UI code to accept a negative delta in the iterator. There
are already many /diff responses with negative delta that will be
cached by browsers for 7 days.

There may be other issues with the intraline diff algorithm that
allows it to create this final INSERT span within the REPLACE
span, but the code is essentially unchanged for many years in
Gerrit Code Review. Handle the corner case for now in the UI while
the server code is investigated further.

Change-Id: Ibec0fc845356af7c02f25acac23c4e709f7c3a34
Added global request handlers to SshDaemon

Since sshd 0.10.0 the handling of global requests
is refactored out of [1] ServerConnectionService.globalRequest
method to AbstractConnectionService.globalRequest.
The implementation has been refactored into a list
of RequestHandlers, one for each type of request.

These handlers are never set in SshDaemon constructor
as they should be.

See SshServer.getUpDefaultServer line 503

Change-Id: I7a38145c021538838d11427950db66eb57a50582
Bump bouncycastle verison to 1.49

Many bugs were fixed since version 1.44 that we are using[1].

JARs artifacts were renamed.

[1] http://www.bouncycastle.org/releasenotes.html

Change-Id: Ie2b22328c77b0100dfff61139b737894b88e7664
Install open ssl jar into Gerrit site for bouncycastle crypto provider

937d527ac0e4ee685fccb60ae604406a6638daec upgraded bouncy castle to 1.49.

The old JAR artifact was renamed and split to number of files. For Gerrit
two libraries must be downloaded and be available under `$gerrit_site/lib`:

* bcprov-jdk15on-149.jar
* bcpkix-jdk15on-149.jar

Update download logic to support a basic concept of required dependencies,
ensuring BC provider is downloaded if the SSL library is installed by init.

Change-Id: I60092ebe136f78a5649fe8512737275f50195a34
Fix log spew caused by DeleteBranch constructor

Every time branches are accessed the server logs a nasty Guice
trace preventing DeleteBranch from being created. The view must
create without enforcing the IdentifiedUser to exist. The solution
throughout the rest of Gerrit REST API code is to use Provider<X>
instead of X to allow Guice to defer this resolution.

Change-Id: If7fd7f4c38bcbc685d4f9451479da7a9ed432564
ChangeScreen2: Only reset the commit message text on cancel

Allow the user to begin editing the commit message, dismiss the
box by clicking outside of it (e.g. to copy part of a file name
from the Files table), and then re-open the current draft text
without resetting the box.

Only reset the box when the user explicitly clicks Cancel. Track
this by using the empty string in the text editor to mean there
is no valid message and the current original should be used.

Change-Id: Icd99b92c50ff92e0b1dc31a78fc57612f57a143b
Split PGPEncryptedDataGenerator creation out into a utility method

Split the creation of PGPEncryptedDataGenerator out into a utility
method.  Inline the call to the open() method on the returned generator
rather than storing the generator in a temporary variable.

Suppress deprecation warnings caused by using methods that have been
deprecated in the new version of Bouncycastle that was introduced
recently.  We cannot yet replace the calls with the newer versions
because some Gerrit sites still use the older version of Bouncycastle.

Change-Id: I98f4b7c7bf8ab1ee74eb8bbc86b673d057d98e46
Use Provider for IdentifiedUser in CreateBranch constructor

This is the same fix that was already done for DeleteBranch's
constructor in If7fd7f4c38bcbc685d4f9451479da7a9ed432564.

Change-Id: Ied38df303eaf4ea1893527e947633445974e9d19
Only permit current patch set to edit the commit message

Do not allow users to replace a more recent patch set with an older
patch set when there is a race between the web UI and the command
line git client:

 1. Upload a new change (Patch Set 1)
 2. Open the code review page in a browser
 3. Upload a second version of the change (Patch Set 2)

 4. Without refreshing the code review page, so that it's still
    showing Patch Set 1, click the Edit Message button, change the
    commit message, and hit save.

 5. Note that this has created a Patch Set 3 with file contents taken
    from Patch Set 1 but the edited message.

Change-Id: I73af89989b72d9e702061b3746390df68cef4b62
Merge changes Ied38df30,I98f4b7c7,Icd99b92c,If7fd7f4c into stable-2.8

* changes:
  Use Provider for IdentifiedUser in CreateBranch constructor
  Split PGPEncryptedDataGenerator creation out into a utility method
  ChangeScreen2: Only reset the commit message text on cancel
  Fix log spew caused by DeleteBranch constructor
Merge "Added global request handlers to SshDaemon" into stable-2.8