Merge branch 'stable-2.8' into stable-2.9
* stable-2.8: SideBySide2: Fix failure to load from "ISE EditIterator out of bounds" Remove "Click to" from topic edit button's tooltip Fix: wrongly throw 'commit already exists' exception Update sshd to 0.11.0 Bump SSHD version to 0.10.1 and enable nio2 backend Conflicts: gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.ui.xml Change-Id: I63c1e12bbd413a8e212de5b2a8cf71fa2a2ce52d
This commit is contained in:
@@ -2683,6 +2683,14 @@ namespace. To alias `replication start` to `gerrit replicate`:
|
||||
[[sshd]]
|
||||
=== Section sshd
|
||||
|
||||
[[sshd.backend]]sshd.backend::
|
||||
+
|
||||
Starting from version 0.9.0 Apache SSHD project added support for NIO2
|
||||
IoSession. To use the new NIO2 session the `backend` option must be set
|
||||
to `NIO2`.
|
||||
+
|
||||
By default, `MINA`.
|
||||
|
||||
[[sshd.listenAddress]]sshd.listenAddress::
|
||||
+
|
||||
Specifies the local addresses the internal SSHD should listen
|
||||
|
||||
@@ -32,7 +32,7 @@ limitations under the License.
|
||||
<g:Image ui:field='editIcon'
|
||||
resource='{ico.edit}'
|
||||
styleName='{style.edit}'
|
||||
title='Click to edit topic (Shortcut: t)'/>
|
||||
title='Edit topic (Shortcut: t)'/>
|
||||
</div>
|
||||
|
||||
<div ui:field='form' style='display: none' aria-hidden='true'>
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.codemirror.lib.LineCharacter;
|
||||
class EditIterator {
|
||||
private final JsArrayString lines;
|
||||
private final int startLine;
|
||||
private int currLineIndex;
|
||||
private int currLineOffset;
|
||||
private int line;
|
||||
private int pos;
|
||||
|
||||
EditIterator(JsArrayString lineArray, int start) {
|
||||
lines = lineArray;
|
||||
@@ -31,27 +31,44 @@ class EditIterator {
|
||||
}
|
||||
|
||||
LineCharacter advance(int numOfChar) {
|
||||
while (currLineIndex < lines.length()) {
|
||||
int lengthWithNewline =
|
||||
lines.get(currLineIndex).length() - currLineOffset + 1;
|
||||
if (numOfChar < lengthWithNewline) {
|
||||
numOfChar = adjustForNegativeDelta(numOfChar);
|
||||
|
||||
while (line < lines.length()) {
|
||||
int len = lines.get(line).length() - pos + 1; // + 1 for LF
|
||||
if (numOfChar < len) {
|
||||
LineCharacter at = LineCharacter.create(
|
||||
startLine + currLineIndex,
|
||||
numOfChar + currLineOffset);
|
||||
currLineOffset += numOfChar;
|
||||
startLine + line,
|
||||
numOfChar + pos);
|
||||
pos += numOfChar;
|
||||
return at;
|
||||
}
|
||||
numOfChar -= lengthWithNewline;
|
||||
advanceLine();
|
||||
|
||||
numOfChar -= len;
|
||||
line++;
|
||||
pos = 0;
|
||||
|
||||
if (numOfChar == 0) {
|
||||
return LineCharacter.create(startLine + currLineIndex, 0);
|
||||
return LineCharacter.create(startLine + line, 0);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("EditIterator index out of bound");
|
||||
}
|
||||
|
||||
private void advanceLine() {
|
||||
currLineIndex++;
|
||||
currLineOffset = 0;
|
||||
throw new IllegalStateException("EditIterator index out of bounds");
|
||||
}
|
||||
|
||||
private int adjustForNegativeDelta(int n) {
|
||||
while (n < 0) {
|
||||
if (-n <= pos) {
|
||||
pos += n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
n += pos;
|
||||
line--;
|
||||
if (line < 0) {
|
||||
throw new IllegalStateException("EditIterator index out of bounds");
|
||||
}
|
||||
pos = lines.get(line).length() + 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,13 @@ public class EditIteratorTest extends GwtTest {
|
||||
lines.push("3rd");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegativeAdvance() {
|
||||
EditIterator i = new EditIterator(lines, 0);
|
||||
assertLineChsEqual(LineCharacter.create(1, 1), i.advance(5));
|
||||
assertLineChsEqual(LineCharacter.create(0, 3), i.advance(-2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoAdvance() {
|
||||
EditIterator iter = new EditIterator(lines, 0);
|
||||
|
||||
@@ -1801,7 +1801,7 @@ public class ReceiveCommits {
|
||||
|
||||
for (final Ref r : rp.getRepository().getRefDatabase()
|
||||
.getRefs("refs/changes").values()) {
|
||||
if (r.getObjectId().equals(inputCommand.getNewId())) {
|
||||
if (r.getObjectId().equals(newCommit)) {
|
||||
reject(inputCommand, "commit already exists (in the project)");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,10 +65,11 @@ import org.apache.sshd.common.forward.TcpipServerChannel;
|
||||
import org.apache.sshd.common.future.CloseFuture;
|
||||
import org.apache.sshd.common.future.SshFutureListener;
|
||||
import org.apache.sshd.common.io.IoAcceptor;
|
||||
import org.apache.sshd.common.io.IoServiceFactory;
|
||||
import org.apache.sshd.common.io.IoServiceFactoryFactory;
|
||||
import org.apache.sshd.common.io.IoSession;
|
||||
import org.apache.sshd.common.io.mina.MinaServiceFactory;
|
||||
import org.apache.sshd.common.io.mina.MinaServiceFactoryFactory;
|
||||
import org.apache.sshd.common.io.mina.MinaSession;
|
||||
import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
|
||||
import org.apache.sshd.common.mac.HMACMD5;
|
||||
import org.apache.sshd.common.mac.HMACMD596;
|
||||
import org.apache.sshd.common.mac.HMACSHA1;
|
||||
@@ -188,8 +189,13 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
||||
final String kerberosPrincipal = cfg.getString(
|
||||
"sshd", null, "kerberosPrincipal");
|
||||
|
||||
System.setProperty(IoServiceFactory.class.getName(),
|
||||
MinaServiceFactory.class.getName());
|
||||
SshSessionBackend backend = cfg.getEnum(
|
||||
"sshd", null, "backend", SshSessionBackend.MINA);
|
||||
|
||||
System.setProperty(IoServiceFactoryFactory.class.getName(),
|
||||
backend == SshSessionBackend.MINA
|
||||
? MinaServiceFactoryFactory.class.getName()
|
||||
: Nio2ServiceFactoryFactory.class.getName());
|
||||
|
||||
if (SecurityUtils.isBouncyCastleRegistered()) {
|
||||
initProviderBouncyCastle();
|
||||
@@ -284,8 +290,10 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
||||
public synchronized void stop() {
|
||||
if (acceptor != null) {
|
||||
try {
|
||||
acceptor.dispose();
|
||||
acceptor.close(true).await();
|
||||
log.info("Stopped Gerrit SSHD");
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Exception caught while closing", e);
|
||||
} finally {
|
||||
acceptor = null;
|
||||
}
|
||||
@@ -571,6 +579,11 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
||||
@Override
|
||||
public SshFile getFile(String file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileSystemView getNormalizedView() {
|
||||
return null;
|
||||
}};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,15 @@ EXCLUDE = [
|
||||
'META-INF/NOTICE',
|
||||
]
|
||||
|
||||
maven_jar(
|
||||
name = 'sshd',
|
||||
id = 'org.apache.sshd:sshd-core:0.11.0',
|
||||
sha1 = '450da44553c98805ca6bb5709cad54df4acb802a',
|
||||
license = 'Apache2.0',
|
||||
deps = [':core'],
|
||||
exclude = EXCLUDE,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'core',
|
||||
id = 'org.apache.mina:mina-core:2.0.7',
|
||||
@@ -13,13 +22,3 @@ maven_jar(
|
||||
license = 'Apache2.0',
|
||||
exclude = EXCLUDE,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'sshd',
|
||||
id = 'org.apache.sshd:sshd-core:0.9.0.201311081',
|
||||
sha1 = '38f7ac8602e70fa05fdc6147d204198e9cefe5bc',
|
||||
license = 'Apache2.0',
|
||||
deps = [':core'],
|
||||
exclude = EXCLUDE,
|
||||
repository = GERRIT,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user