Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  SiteLibraryLoaderUtil: Add debug log of the loaded libraries
  ShowConnections: Fix display for connection time older than one day

Change-Id: I19656f0ddd8d48219af3a29c6bcee4e01897d477
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/SiteLibraryLoaderUtil.java b/gerrit-common/src/main/java/com/google/gerrit/common/SiteLibraryLoaderUtil.java
index 538565a..e8fa896 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/SiteLibraryLoaderUtil.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/SiteLibraryLoaderUtil.java
@@ -15,6 +15,7 @@
 package com.google.gerrit.common;
 
 import static com.google.gerrit.common.FileUtil.lastModified;
+import static java.util.stream.Collectors.joining;
 
 import com.google.common.annotations.GwtIncompatible;
 import com.google.common.collect.ComparisonChain;
@@ -35,12 +36,18 @@
 
   public static void loadSiteLib(Path libdir) {
     try {
-      IoUtil.loadJARs(listJars(libdir));
+      List<Path> jars = listJars(libdir);
+      IoUtil.loadJARs(jars);
+      log.debug("Loaded site libraries: {}", jarList(jars));
     } catch (IOException e) {
       log.error("Error scanning lib directory " + libdir, e);
     }
   }
 
+  private static String jarList(List<Path> jars) {
+    return jars.stream().map(p -> p.getFileName().toString()).collect(joining(","));
+  }
+
   public static List<Path> listJars(Path dir) throws IOException {
     DirectoryStream.Filter<Path> filter =
         new DirectoryStream.Filter<Path>() {
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ShowConnections.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ShowConnections.java
index a8452c8..afbdf5d 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ShowConnections.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ShowConnections.java
@@ -174,7 +174,7 @@
   }
 
   private static String time(long now, long time) {
-    if (time - now < 24 * 60 * 60 * 1000L) {
+    if (now - time < 24 * 60 * 60 * 1000L) {
       return new SimpleDateFormat("HH:mm:ss").format(new Date(time));
     }
     return new SimpleDateFormat("MMM-dd").format(new Date(time));