From d74daad1e064da9614c5ca2c0138c8046cfb0829 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 16 Jan 2020 13:07:20 +0100 Subject: [PATCH 01/22] Update bazlets and bazel version - bazlets need to be updated to react on Maven central no longer supporting http protocol but only https - update bazel to 2.0 Change-Id: I07f5f050f3b1db2014a5198a28b6bbf893434814 Signed-off-by: Matthias Sohn --- .bazelversion | 2 +- WORKSPACE | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelversion b/.bazelversion index 3eefcb9dd..227cea215 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -1.0.0 +2.0.0 diff --git a/WORKSPACE b/WORKSPACE index 5fd2ed90b..385ad7ec4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -20,7 +20,7 @@ check_bazel_version() load("//tools:bazlets.bzl", "load_bazlets") -load_bazlets(commit = "09a035e98077dce549d5f6a7472d06c4b8f792d2") +load_bazlets(commit = "f53f51fb660552d0581aa0ba52c3836ed63d56a3") load( "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", From be49375fb82894775ca5701ba659f0e5995336fc Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 16 Jan 2020 01:54:38 +0100 Subject: [PATCH 02/22] Update Orbit to I20200115225246 and update dependencies update - javaewah to 1.1.7.v20200107-0831 - org.apache.commons.codec to 1.13.0.v20200108-0001 - org.apache.commons.compress to 1.19.0.v20200106-2343 - org.apache.httpcomponents.httpclient to 4.5.10.v20200114-1512 - org.apache.httpcomponents.httpcore to 4.4.12.v20200108-1212 CQ: 21194 CQ: 21195 CQ: 21199 CQ: 21346 CQ: 21347 Change-Id: I1943f1c3bf1bb5d71b666cb6aea6083e80ff82dc Signed-off-by: Matthias Sohn --- WORKSPACE | 46 ++++++------- .../org.eclipse.jgit.target/jgit-4.10.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.10.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.11.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.11.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.12.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.12.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.13.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.13.tpd | 2 +- .../jgit-4.14-staging.target | 24 +++---- .../jgit-4.14-staging.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.8.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.8.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.9.target | 24 +++---- .../org.eclipse.jgit.target/jgit-4.9.tpd | 2 +- .../orbit/I20200115225246.tpd | 65 +++++++++++++++++++ pom.xml | 8 +-- 21 files changed, 209 insertions(+), 144 deletions(-) create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd diff --git a/WORKSPACE b/WORKSPACE index 385ad7ec4..0209d6d88 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -77,20 +77,20 @@ maven_jar( maven_jar( name = "javaewah", - artifact = "com.googlecode.javaewah:JavaEWAH:1.1.6", - sha1 = "94ad16d728b374d65bd897625f3fbb3da223a2b6", + artifact = "com.googlecode.javaewah:JavaEWAH:1.1.7", + sha1 = "570dde3cd706ae10c62fe19b150928cfdb415e87", ) maven_jar( name = "httpclient", - artifact = "org.apache.httpcomponents:httpclient:4.5.6", - sha1 = "1afe5621985efe90a92d0fbc9be86271efbe796f", + artifact = "org.apache.httpcomponents:httpclient:4.5.10", + sha1 = "7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5", ) maven_jar( name = "httpcore", - artifact = "org.apache.httpcomponents:httpcore:4.4.10", - sha1 = "acc54d9b28bdffe4bbde89ed2e4a1e86b5285e2b", + artifact = "org.apache.httpcomponents:httpcore:4.4.12", + sha1 = "21ebaf6d532bc350ba95bd81938fa5f0e511c132", ) maven_jar( @@ -107,8 +107,8 @@ maven_jar( maven_jar( name = "commons-codec", - artifact = "commons-codec:commons-codec:1.10", - sha1 = "4b95f4897fa13f2cd904aee711aeafc0c5295cd8", + artifact = "commons-codec:commons-codec:1.13", + sha1 = "3f18e1aa31031d89db6f01ba05d501258ce69d2c", ) maven_jar( @@ -137,8 +137,8 @@ maven_jar( maven_jar( name = "commons-compress", - artifact = "org.apache.commons:commons-compress:1.18", - sha1 = "1191f9f2bc0c47a8cce69193feb1ff0a8bcb37d5", + artifact = "org.apache.commons:commons-compress:1.19", + sha1 = "7e65777fb451ddab6a9c054beb879e521b7eab78", ) maven_jar( @@ -203,48 +203,48 @@ maven_jar( sha1 = "3edcfe49d2c6053a70a2a47e4e1c2f94998a49cf", ) -JETTY_VER = "9.4.24.v20191120" +JETTY_VER = "9.4.25.v20191220" maven_jar( name = "jetty-servlet", artifact = "org.eclipse.jetty:jetty-servlet:" + JETTY_VER, - sha1 = "ca1803fde51b795c0a8346ca8bc6277d9d04d01d", - src_sha1 = "8781c162df92d27456d4370df943f6a5234f32c4", + sha1 = "bee77d6a4f87dc90d5bc142cbd6cef470ec46aae", + src_sha1 = "e8b09b6431fc9cfbff588698ac0262a745fe00e4", ) maven_jar( name = "jetty-security", artifact = "org.eclipse.jetty:jetty-security:" + JETTY_VER, - sha1 = "9fa640d36c088cf55843900043d28aef830ade4d", - src_sha1 = "40128e3547b43f09e176fb0738672f483c477119", + sha1 = "593ff5b5dfd5bf973184329f5d1209b9a411ec12", + src_sha1 = "369f869a13a33d25535db3176a84945e94a3718a", ) maven_jar( name = "jetty-server", artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VER, - sha1 = "7885cc3d5d7701a444acada7ab97f89846514875", - src_sha1 = "709650068c26029303ab3776d1e5ed6a66e0b065", + sha1 = "5b352c9f9135a1c20e4808e5cb1d84fbddfdc460", + src_sha1 = "0f3acc2abcdb86491a2c37074592860cb1100269", ) maven_jar( name = "jetty-http", artifact = "org.eclipse.jetty:jetty-http:" + JETTY_VER, - sha1 = "d3f0b0fb016ef8d35ffb199d928ffbcbfa121c86", - src_sha1 = "b29d870576e3edff354af0dae86c60d5956cd643", + sha1 = "c3aa7da362f1a492667ce754ba16b2535b793668", + src_sha1 = "70ef1436dc895eafe2cc24cf59af6e2d2874d963", ) maven_jar( name = "jetty-io", artifact = "org.eclipse.jetty:jetty-io:" + JETTY_VER, - sha1 = "dcb6d4d505ef74898e3a64a38c40195c01e97119", - src_sha1 = "863a6c575eadb626b50cda13a6484609a9449934", + sha1 = "3eb34b5481012701de0ea9dfaf2bdf1dbb947b16", + src_sha1 = "ad129617793088aaf69eab18a13c9bce02cb1195", ) maven_jar( name = "jetty-util", artifact = "org.eclipse.jetty:jetty-util:" + JETTY_VER, - sha1 = "3095acb088f4ff9e3fd9aedf98db73e3c18ea849", - src_sha1 = "f503199317d9df74062d722db4a7af8cf5e59322", + sha1 = "fd8b642cc16728f1c36ca6a64653cb1b26ec0232", + src_sha1 = "c84dc3026cc4aea013dc97b18228756816167745", ) BOUNCYCASTLE_VER = "1.64" diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 3cfe1b395..09a21ee2b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd index 19ebf13e3..4770e1756 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd @@ -1,7 +1,7 @@ target "jgit-4.10" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/2018-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index b42ae5758..e7ef174a1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd index b54e1771b..bee306939 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd @@ -1,7 +1,7 @@ target "jgit-4.11" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/2019-03/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index 3b27528c3..dc3930606 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd index fe5a8d63b..6bf4c29b4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd @@ -1,7 +1,7 @@ target "jgit-4.12" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/2019-06/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index c87f25d3f..d6c091d99 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd index caeae9c60..a17a624ea 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd @@ -1,7 +1,7 @@ target "jgit-4.13" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index 92e67946a..c168bcc1e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd index 0b61b90d0..18bcbff9a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd @@ -1,7 +1,7 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/staging/2019-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index c77b6fca6..efb0910e4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index 895f37c6c..11ea74ea0 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,7 +1,7 @@ target "jgit-4.6" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/neon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 5fbe5e980..9508aed8e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index 19a733b3f..6b745b5da 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,7 +1,7 @@ target "jgit-4.7" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/oxygen/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index c4c5799f5..8da1c503e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd index 1aad52ad4..5630fbc19 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd @@ -1,7 +1,7 @@ target "jgit-4.8" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/photon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index de451fd6a..9340c2a84 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -29,8 +29,8 @@ - - + + @@ -41,16 +41,16 @@ - - - - + + + + - - - - + + + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd index 9ab5a5921..38619652a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd @@ -1,7 +1,7 @@ target "jgit-4.9" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/R20191126223242-2019-12.tpd" +include "orbit/I20200115225246.tpd" location "http://download.eclipse.org/releases/2018-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd new file mode 100644 index 000000000..c43455e6a --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd @@ -0,0 +1,65 @@ +target "I20200115225246" with source configurePhase +// see http://download.eclipse.org/tools/orbit/downloads/ + +location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200115225246/repository" { + com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] + com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] + com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] + com.jcraft.jsch.source [0.1.55.v20190404-1902,0.1.55.v20190404-1902] + com.jcraft.jzlib [1.1.1.v201205102305,1.1.1.v201205102305] + com.jcraft.jzlib.source [1.1.1.v201205102305,1.1.1.v201205102305] + javaewah [1.1.7.v20200107-0831,1.1.7.v20200107-0831] + javaewah.source [1.1.7.v20200107-0831,1.1.7.v20200107-0831] + javax.servlet [3.1.0.v201410161800,3.1.0.v201410161800] + javax.servlet.source [3.1.0.v201410161800,3.1.0.v201410161800] + net.bytebuddy.byte-buddy [1.9.0.v20181107-1410,1.9.0.v20181107-1410] + net.bytebuddy.byte-buddy-agent [1.9.0.v20181106-1534,1.9.0.v20181106-1534] + net.bytebuddy.byte-buddy-agent.source [1.9.0.v20181106-1534,1.9.0.v20181106-1534] + net.bytebuddy.byte-buddy.source [1.9.0.v20181107-1410,1.9.0.v20181107-1410] + net.i2p.crypto.eddsa [0.3.0.v20181102-1323,0.3.0.v20181102-1323] + net.i2p.crypto.eddsa.source [0.3.0.v20181102-1323,0.3.0.v20181102-1323] + org.apache.ant [1.10.7.v20190926-0324,1.10.7.v20190926-0324] + org.apache.ant.source [1.10.7.v20190926-0324,1.10.7.v20190926-0324] + org.apache.commons.codec [1.13.0.v20200108-0001,1.13.0.v20200108-0001] + org.apache.commons.codec.source [1.13.0.v20200108-0001,1.13.0.v20200108-0001] + org.apache.commons.compress [1.19.0.v20200106-2343,1.19.0.v20200106-2343] + org.apache.commons.compress.source [1.19.0.v20200106-2343,1.19.0.v20200106-2343] + org.apache.commons.logging [1.2.0.v20180409-1502,1.2.0.v20180409-1502] + org.apache.commons.logging.source [1.2.0.v20180409-1502,1.2.0.v20180409-1502] + org.apache.httpcomponents.httpclient [4.5.10.v20200114-1512,4.5.10.v20200114-1512] + org.apache.httpcomponents.httpclient.source [4.5.10.v20200114-1512,4.5.10.v20200114-1512] + org.apache.httpcomponents.httpcore [4.4.12.v20200108-1212,4.4.12.v20200108-1212] + org.apache.httpcomponents.httpcore.source [4.4.12.v20200108-1212,4.4.12.v20200108-1212] + org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815] + org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815] + org.apache.sshd.osgi [2.2.0.v20190425-2127,2.2.0.v20190425-2127] + org.apache.sshd.osgi.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127] + org.apache.sshd.sftp [2.2.0.v20190425-2127,2.2.0.v20190425-2127] + org.apache.sshd.sftp.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127] + org.bouncycastle.bcpg [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.bouncycastle.bcpg.source [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.bouncycastle.bcpkix [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.bouncycastle.bcpkix.source [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.bouncycastle.bcprov [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.bouncycastle.bcprov.source [1.64.0.v20191109-0815,1.64.0.v20191109-0815] + org.hamcrest [1.1.0.v20090501071000,1.1.0.v20090501071000] + org.hamcrest.core [1.3.0.v20180420-1519,1.3.0.v20180420-1519] + org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519] + org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246] + org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246] + org.junit [4.12.0.v201504281640,4.12.0.v201504281640] + org.junit.source [4.12.0.v201504281640,4.12.0.v201504281640] + org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218] + org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218] + org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420] + org.mockito.source [2.23.0.v20190527-1420,2.23.0.v20190527-1420] + org.objenesis [2.6.0.v20180420-1519,2.6.0.v20180420-1519] + org.objenesis.source [2.6.0.v20180420-1519,2.6.0.v20180420-1519] + org.slf4j.api [1.7.2.v20121108-1250,1.7.2.v20121108-1250] + org.slf4j.api.source [1.7.2.v20121108-1250,1.7.2.v20121108-1250] + org.slf4j.impl.log4j12 [1.7.2.v20131105-2200,1.7.2.v20131105-2200] + org.slf4j.impl.log4j12.source [1.7.2.v20131105-2200,1.7.2.v20131105-2200] + org.tukaani.xz [1.8.0.v20180207-1613,1.8.0.v20180207-1613] + org.tukaani.xz.source [1.8.0.v20180207-1613,1.8.0.v20180207-1613] +} + diff --git a/pom.xml b/pom.xml index 2eeda672d..a88da4281 100644 --- a/pom.xml +++ b/pom.xml @@ -155,17 +155,17 @@ 2.2.0 0.1.55 1.1.1 - 1.1.6 + 1.1.7 4.12 1C 2.33 - 1.18 + 1.19 4.3.1 3.1.0 9.4.25.v20191220 0.14.1 - 4.5.6 - 4.4.10 + 4.5.10 + 4.4.12 1.7.2 1.2.15 3.1.1 From eca34be43ce3309344cd1ec2914d3201121af893 Mon Sep 17 00:00:00 2001 From: Andre Bossert Date: Sun, 12 Jan 2020 17:44:23 +0100 Subject: [PATCH 03/22] Extract method refactoring in class DirCacheCheckout * added new public method getContent() * changed checkoutEntry() to use the new getContent() method * changed runExternalFilterCommand() parameter "entry" to "path" to be independent from DirCacheEntry type * removed runExternalFilterCommand() parameter "fs" as it can be derived from repo Bug: 356832 Change-Id: If8991b74870e0d8728093e98a990f93f1871b76a Signed-off-by: Andre Bossert --- .../jgit/dircache/DirCacheCheckout.java | 131 ++++++++++-------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index bbaed3766..fdc89cd54 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -3,41 +3,14 @@ * Copyright (C) 2008, Robin Rosenberg * Copyright (C) 2008, Roger C. Soares * Copyright (C) 2006, Shawn O. Pearce - * Copyright (C) 2010, Chrisian Halstrick and - * other copyright owners as documented in the project's IP log. + * Copyright (C) 2010, Chrisian Halstrick + * Copyright (C) 2019-2020, Andre Bossert * * This program and the accompanying materials are made available under the - * terms of the Eclipse Distribution License v1.0 which accompanies this - * distribution, is reproduced below, and is available at - * http://www.eclipse.org/org/documents/edl-v10.php + * terms of the Eclipse Distribution License v. 1.0 which is available at + * https://www.eclipse.org/org/documents/edl-v10.php. * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * - Neither the name of the Eclipse Foundation, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ package org.eclipse.jgit.dircache; @@ -1504,29 +1477,9 @@ public class DirCacheCheckout { File tmpFile = File.createTempFile( "._" + name, null, parentDir); //$NON-NLS-1$ - EolStreamType nonNullEolStreamType; - if (checkoutMetadata.eolStreamType != null) { - nonNullEolStreamType = checkoutMetadata.eolStreamType; - } else if (opt.getAutoCRLF() == AutoCRLF.TRUE) { - nonNullEolStreamType = EolStreamType.AUTO_CRLF; - } else { - nonNullEolStreamType = EolStreamType.DIRECT; - } - try (OutputStream channel = EolStreamTypeUtil.wrapOutputStream( - new FileOutputStream(tmpFile), nonNullEolStreamType)) { - if (checkoutMetadata.smudgeFilterCommand != null) { - if (FilterCommandRegistry - .isRegistered(checkoutMetadata.smudgeFilterCommand)) { - runBuiltinFilterCommand(repo, checkoutMetadata, ol, - channel); - } else { - runExternalFilterCommand(repo, entry, checkoutMetadata, ol, - fs, channel); - } - } else { - ol.copyTo(channel); - } - } + getContent(repo, entry.getPathString(), checkoutMetadata, ol, opt, + new FileOutputStream(tmpFile)); + // The entry needs to correspond to the on-disk filesize. If the content // was filtered (either by autocrlf handling or smudge filters) ask the // filesystem again for the length. Otherwise the objectloader knows the @@ -1565,11 +1518,69 @@ public class DirCacheCheckout { entry.setLastModified(fs.lastModifiedInstant(f)); } + /** + * Return filtered content for a specific object (blob). EOL handling and + * smudge-filter handling are applied in the same way as it would be done + * during a checkout. + * + * @param repo + * the repository + * @param path + * the path used to determine the correct filters for the object + * @param checkoutMetadata + * containing + *
    + *
  • smudgeFilterCommand to be run for smudging the object
  • + *
  • eolStreamType used for stream conversion (can be + * null)
  • + *
+ * @param ol + * the object loader to read raw content of the object + * @param opt + * the working tree options where only 'core.autocrlf' is used + * for EOL handling if 'checkoutMetadata.eolStreamType' is not + * valid + * @param os + * the output stream the filtered content is written to. The + * caller is responsible to close the stream. + * @throws IOException + * + * @since 5.7 + */ + public static void getContent(Repository repo, String path, + CheckoutMetadata checkoutMetadata, ObjectLoader ol, + WorkingTreeOptions opt, OutputStream os) + throws IOException { + EolStreamType nonNullEolStreamType; + if (checkoutMetadata.eolStreamType != null) { + nonNullEolStreamType = checkoutMetadata.eolStreamType; + } else if (opt.getAutoCRLF() == AutoCRLF.TRUE) { + nonNullEolStreamType = EolStreamType.AUTO_CRLF; + } else { + nonNullEolStreamType = EolStreamType.DIRECT; + } + try (OutputStream channel = EolStreamTypeUtil.wrapOutputStream( + os, nonNullEolStreamType)) { + if (checkoutMetadata.smudgeFilterCommand != null) { + if (FilterCommandRegistry + .isRegistered(checkoutMetadata.smudgeFilterCommand)) { + runBuiltinFilterCommand(repo, checkoutMetadata, ol, + channel); + } else { + runExternalFilterCommand(repo, path, checkoutMetadata, ol, + channel); + } + } else { + ol.copyTo(channel); + } + } + } + // Run an external filter command - private static void runExternalFilterCommand(Repository repo, - DirCacheEntry entry, - CheckoutMetadata checkoutMetadata, ObjectLoader ol, FS fs, + private static void runExternalFilterCommand(Repository repo, String path, + CheckoutMetadata checkoutMetadata, ObjectLoader ol, OutputStream channel) throws IOException { + FS fs = repo.getFS(); ProcessBuilder filterProcessBuilder = fs.runInShell( checkoutMetadata.smudgeFilterCommand, new String[0]); filterProcessBuilder.directory(repo.getWorkTree()); @@ -1588,12 +1599,12 @@ public class DirCacheCheckout { } catch (IOException | InterruptedException e) { throw new IOException(new FilterFailedException(e, checkoutMetadata.smudgeFilterCommand, - entry.getPathString())); + path)); } if (rc != 0) { throw new IOException(new FilterFailedException(rc, checkoutMetadata.smudgeFilterCommand, - entry.getPathString(), + path, result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE), RawParseUtils.decode(result.getStderr() .toByteArray(MAX_EXCEPTION_TEXT_SIZE)))); From 926d392ea57831336e034475c5ab07c107a12562 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Mon, 20 Jan 2020 19:07:48 +0100 Subject: [PATCH 04/22] Update to Tycho 1.6.0 Not many changes, but might lead to shorter build times. Change-Id: I5d629e49e8bbdef7a5b116d4f28cdbf8a8528cf0 Signed-off-by: Michael Keppler Signed-off-by: Matthias Sohn --- org.eclipse.jgit.packaging/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml index ae777789d..35caa3e24 100644 --- a/org.eclipse.jgit.packaging/pom.xml +++ b/org.eclipse.jgit.packaging/pom.xml @@ -22,7 +22,7 @@ JGit Tycho Parent - 1.5.1 + 1.6.0 ${tycho-version} jgit-4.6 diff --git a/pom.xml b/pom.xml index a88da4281..2e16b37f9 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ 1.7.2 1.2.15 3.1.1 - 1.5.1 + 1.6.0 2.8.2 1.64 3.1.12.2 From c02a57f4fac277385789eb953138e77e713cb892 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 21 Jan 2020 17:27:59 +0100 Subject: [PATCH 05/22] Update to Orbit I20200120214610 and JUnit to 4.13 Since version 4.13 JUnit has an assertThrows method. Remove the implementation in MoreAsserts and use the one from JUnit. CQ: 21439 Change-Id: I086baa94aa3069cebe87c4cbf91ed1534523c6cb Signed-off-by: David Pursehouse Signed-off-by: Matthias Sohn --- WORKSPACE | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 8 ++-- .../META-INF/MANIFEST.MF | 2 +- org.eclipse.jgit.junit/META-INF/MANIFEST.MF | 10 ++-- .../META-INF/MANIFEST.MF | 8 ++-- .../META-INF/MANIFEST.MF | 6 +-- .../org.eclipse.jgit.target/jgit-4.10.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.10.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.11.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.11.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.12.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.12.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.13.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.13.tpd | 2 +- .../jgit-4.14-staging.target | 8 ++-- .../jgit-4.14-staging.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.8.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.8.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.9.target | 8 ++-- .../org.eclipse.jgit.target/jgit-4.9.tpd | 2 +- ...20200115225246.tpd => I20200120214610.tpd} | 8 ++-- .../META-INF/MANIFEST.MF | 4 +- .../META-INF/MANIFEST.MF | 6 +-- org.eclipse.jgit.test/META-INF/MANIFEST.MF | 10 ++-- .../src/org/eclipse/jgit/lib/MoreAsserts.java | 46 ------------------- .../storage/reftable/ReftableTest.java | 2 +- .../transport/UploadPackReachabilityTest.java | 2 +- .../jgit/transport/UploadPackTest.java | 2 +- pom.xml | 2 +- 34 files changed, 83 insertions(+), 129 deletions(-) rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/{I20200115225246.tpd => I20200120214610.tpd} (95%) delete mode 100644 org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java diff --git a/WORKSPACE b/WORKSPACE index 0209d6d88..8c3c27f75 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -155,8 +155,8 @@ maven_jar( maven_jar( name = "junit", - artifact = "junit:junit:4.12", - sha1 = "2973d150c0dc1fefe998f834810d68f278ea58ec", + artifact = "junit:junit:4.13", + sha1 = "e49ccba652b735c93bd6e6f59760d8254cf597dd", ) maven_jar( diff --git a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF index a8e76b254..95a6da374 100644 --- a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF @@ -14,4 +14,4 @@ Import-Package: org.apache.tools.ant, org.eclipse.jgit.lib;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.hamcrest.core;version="[1.1.0,2.0.0)", - org.junit;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)" diff --git a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF index d4ea15886..ad9413f50 100644 --- a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF @@ -49,8 +49,8 @@ Import-Package: javax.servlet;version="[2.5.0,3.2.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.hamcrest;version="[1.1.0,2.0.0)", org.hamcrest.core;version="[1.1.0,2.0.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)" Require-Bundle: org.hamcrest.library;bundle-version="[1.1.0,2.0.0)" diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF index 5c889f6df..a622488cd 100644 --- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF @@ -30,7 +30,7 @@ Import-Package: javax.servlet;version="[2.5.0,3.2.0)", org.eclipse.jgit.revwalk;version="[5.7.0,5.8.0)", org.eclipse.jgit.transport;version="[5.7.0,5.8.0)", org.eclipse.jgit.transport.resolver;version="[5.7.0,5.8.0)", - org.junit;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)" Export-Package: org.eclipse.jgit.junit.http;version="5.7.0"; uses:="org.eclipse.jgit.transport, org.eclipse.jgit.junit, diff --git a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF index 871e32915..531f3be23 100644 --- a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF @@ -25,11 +25,11 @@ Import-Package: org.eclipse.jgit.annotations;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.io;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.time;version="[5.7.0,5.8.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)", - org.junit.runners.model;version="[4.12,5.0.0)", + org.junit;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)", + org.junit.runners.model;version="[4.13,5.0.0)", org.slf4j;version="[1.7.0,2.0.0)" Export-Package: org.eclipse.jgit.junit;version="5.7.0"; uses:="org.eclipse.jgit.dircache, diff --git a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF index c4d3c90f0..ac7ee5f5c 100644 --- a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF @@ -47,7 +47,7 @@ Import-Package: javax.servlet;version="[3.1.0,4.0.0)", org.eclipse.jgit.treewalk.filter;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.hamcrest.core;version="[1.1.0,2.0.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)" diff --git a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF index e3fcf70ce..2682ba6b8 100644 --- a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Import-Package: org.eclipse.jgit.internal.storage.dfs;version="[5.7.0,5.8.0)", org.eclipse.jgit.treewalk.filter;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.hamcrest.core;version="[1.1.0,2.0.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)" Export-Package: org.eclipse.jgit.lfs.test;version="5.7.0";x-friends:="org.eclipse.jgit.lfs.server.test" diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 09a21ee2b..27c1bf641 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd index 4770e1756..2a0a6060c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd @@ -1,7 +1,7 @@ target "jgit-4.10" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/2018-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index e7ef174a1..d1046cd41 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd index bee306939..5ca669b51 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd @@ -1,7 +1,7 @@ target "jgit-4.11" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/2019-03/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index dc3930606..a2aa362ba 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd index 6bf4c29b4..8f9736bc9 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd @@ -1,7 +1,7 @@ target "jgit-4.12" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/2019-06/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index d6c091d99..72f1f0b85 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd index a17a624ea..e785aa0f9 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd @@ -1,7 +1,7 @@ target "jgit-4.13" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index c168bcc1e..e91c4747c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd index 18bcbff9a..c3b73764e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd @@ -1,7 +1,7 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/staging/2019-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index efb0910e4..661085dad 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index 11ea74ea0..a90855bea 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,7 +1,7 @@ target "jgit-4.6" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/neon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 9508aed8e..3cfe837b9 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index 6b745b5da..8da14627c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,7 +1,7 @@ target "jgit-4.7" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/oxygen/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index 8da1c503e..289111545 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd index 5630fbc19..65146f8fe 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd @@ -1,7 +1,7 @@ target "jgit-4.8" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/photon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index 9340c2a84..c6ee0a165 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -68,8 +68,8 @@ - - + + @@ -82,7 +82,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd index 38619652a..63b2948c8 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd @@ -1,7 +1,7 @@ target "jgit-4.9" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200115225246.tpd" +include "orbit/I20200120214610.tpd" location "http://download.eclipse.org/releases/2018-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd similarity index 95% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd index c43455e6a..3cf7d4c40 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200115225246.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd @@ -1,7 +1,7 @@ -target "I20200115225246" with source configurePhase +target "I20200120214610" with source configurePhase // see http://download.eclipse.org/tools/orbit/downloads/ -location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200115225246/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200120214610/repository" { com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] @@ -47,8 +47,8 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/I202001152252 org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519] org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246] org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246] - org.junit [4.12.0.v201504281640,4.12.0.v201504281640] - org.junit.source [4.12.0.v201504281640,4.12.0.v201504281640] + org.junit [4.13.0.v20200120-1926,4.13.0.v20200120-1926] + org.junit.source [4.13.0.v20200120-1926,4.13.0.v20200120-1926] org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420] diff --git a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF index b48c1e5ff..a7a11b404 100644 --- a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF @@ -26,7 +26,7 @@ Import-Package: org.eclipse.jgit.api;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.io;version="[5.7.0,5.8.0)", org.hamcrest.core;bundle-version="[1.1.0,2.0.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", + org.junit;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", org.kohsuke.args4j;version="[2.33.0,3.0.0)" Require-Bundle: org.tukaani.xz;bundle-version="[1.3.0,2.0.0)" diff --git a/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF index 8fd175644..5bf2563aa 100644 --- a/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF @@ -24,6 +24,6 @@ Import-Package: org.apache.sshd.client.config.hosts;version="[2.2.0,2.3.0)", org.eclipse.jgit.transport.ssh;version="[5.7.0,5.8.0)", org.eclipse.jgit.transport.sshd;version="[5.7.0,5.8.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.experimental.theories;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)" + org.junit;version="[4.13,5.0.0)", + org.junit.experimental.theories;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)" diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF index d8f6bcfe2..509ef0b05 100644 --- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF @@ -70,11 +70,11 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.io;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.sha1;version="[5.7.0,5.8.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.experimental.theories;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)", + org.junit;version="[4.13,5.0.0)", + org.junit.experimental.theories;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)", org.mockito;version="[2.23.0,3.0.0)", org.mockito.invocation;version="[2.23.0,3.0.0)", org.mockito.junit;version="[2.23.0,3.0.0)", diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java deleted file mode 100644 index cd0a6f106..000000000 --- a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019, Google LLC and others - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Distribution License v. 1.0 which is available at - * https://www.eclipse.org/org/documents/edl-v10.php. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -package org.eclipse.jgit.lib; - -/** Assertion methods. */ -public class MoreAsserts { - /** - * Simple version of assertThrows that will be introduced in JUnit 4.13. - * - * @param expected - * Expected throwable class - * @param r - * Runnable that is expected to throw an exception. - * @return The thrown exception. - */ - public static T assertThrows(Class expected, - ThrowingRunnable r) { - try { - r.run(); - } catch (Throwable actual) { - if (expected.isAssignableFrom(actual.getClass())) { - @SuppressWarnings("unchecked") - T toReturn = (T) actual; - return toReturn; - } - throw new AssertionError("Expected " + expected.getSimpleName() - + ", but got " + actual.getClass().getSimpleName(), actual); - } - throw new AssertionError( - "Expected " + expected.getSimpleName() + " to be thrown"); - } - - public interface ThrowingRunnable { - void run() throws Throwable; - } - - private MoreAsserts() { - } -} diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java index f73dfedae..65c48ad89 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java @@ -13,7 +13,6 @@ package org.eclipse.jgit.internal.storage.reftable; import static org.eclipse.jgit.lib.Constants.HEAD; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH; import static org.eclipse.jgit.lib.Constants.R_HEADS; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.eclipse.jgit.lib.Ref.Storage.NEW; import static org.eclipse.jgit.lib.Ref.Storage.PACKED; import static org.hamcrest.CoreMatchers.containsString; @@ -23,6 +22,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java index 2c9712c99..d113eabd8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java @@ -9,10 +9,10 @@ */ package org.eclipse.jgit.transport; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.util.Collections; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 108e5edb7..052cb14bf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -1,6 +1,5 @@ package org.eclipse.jgit.transport; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItems; @@ -10,6 +9,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; diff --git a/pom.xml b/pom.xml index 2e16b37f9..6cf7b3592 100644 --- a/pom.xml +++ b/pom.xml @@ -156,7 +156,7 @@ 0.1.55 1.1.1 1.1.7 - 4.12 + 4.13 1C 2.33 1.19 From c49c0f99124185e622407ccd19fce17d8114d4dc Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 21 Jan 2020 17:50:57 +0100 Subject: [PATCH 06/22] Replace deprecated junit assertion methods with hamcrest Change-Id: Icebe8071eeefbc13d3bdbc231c568209cdc26195 Signed-off-by: Matthias Sohn --- .../jgit/http/test/HttpClientTests.java | 2 +- .../org/eclipse/jgit/diff/DiffEntryTest.java | 4 +-- .../internal/storage/file/GcPackRefsTest.java | 2 +- .../storage/file/PackInserterTest.java | 3 +- .../storage/reftable/ReftableTest.java | 2 +- .../http/NetscapeCookieFileTest.java | 36 +++++++++---------- .../eclipse/jgit/lib/RepositoryCacheTest.java | 2 +- .../jgit/transport/ProtocolV0ParserTest.java | 2 +- .../jgit/transport/ProtocolV2ParserTest.java | 4 +-- .../jgit/transport/TransportHttpTest.java | 4 ++- .../transport/UploadPackReachabilityTest.java | 2 +- ...loadPackRefSortingForReachabilityTest.java | 2 +- .../jgit/transport/UploadPackTest.java | 2 +- .../tst/org/eclipse/jgit/util/LRUMapTest.java | 8 ++--- 14 files changed, 36 insertions(+), 39 deletions(-) diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java index 7b1428849..96657761c 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java @@ -10,12 +10,12 @@ package org.eclipse.jgit.http.test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java index 3886c1595..f8c7dae7d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java @@ -13,9 +13,9 @@ import static org.eclipse.jgit.diff.DiffEntry.DEV_NULL; import static org.eclipse.jgit.util.FileUtils.delete; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; @@ -26,8 +26,8 @@ import org.eclipse.jgit.diff.DiffEntry.ChangeType; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheEditor; import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.dircache.DirCacheEntry; +import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.JGitTestUtil; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.FileMode; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java index 74f1aea6f..8baa3cc34 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java @@ -10,13 +10,13 @@ package org.eclipse.jgit.internal.storage.file; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import java.io.File; import java.io.IOException; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java index 8e438bc0e..8c56480fe 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java @@ -45,15 +45,14 @@ package org.eclipse.jgit.internal.storage.file; import static java.util.Comparator.comparing; import static java.util.stream.Collectors.toList; - import static org.eclipse.jgit.lib.Constants.OBJ_BLOB; import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java index 65c48ad89..009914b35 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java @@ -16,12 +16,12 @@ import static org.eclipse.jgit.lib.Constants.R_HEADS; import static org.eclipse.jgit.lib.Ref.Storage.NEW; import static org.eclipse.jgit.lib.Ref.Storage.PACKED; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileTest.java index 5a7a034ad..6c8c3ba61 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileTest.java @@ -9,6 +9,10 @@ */ package org.eclipse.jgit.internal.transport.http; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.io.InputStream; import java.io.Writer; @@ -27,10 +31,8 @@ import java.util.Set; import java.util.regex.Pattern; import org.eclipse.jgit.internal.storage.file.LockFile; -import org.eclipse.jgit.internal.transport.http.NetscapeCookieFile; import org.eclipse.jgit.util.http.HttpCookiesMatcher; import org.hamcrest.CoreMatchers; -import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -81,11 +83,10 @@ public class NetscapeCookieFileTest { cookie = new HttpCookie("key3", "valueFromSet2"); cookiesExpectedMergedSet.add(cookie); - Assert.assertThat( - NetscapeCookieFile.mergeCookies(cookieSet1, cookieSet2), + assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, cookieSet2), HttpCookiesMatcher.containsInOrder(cookiesExpectedMergedSet)); - Assert.assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, null), + assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, null), HttpCookiesMatcher.containsInOrder(cookieSet1)); } @@ -110,8 +111,7 @@ public class NetscapeCookieFileTest { String expectedExpiration = String .valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000)); - Assert.assertThat( - Files.readAllLines(tmpFile, StandardCharsets.US_ASCII), + assertThat(Files.readAllLines(tmpFile, StandardCharsets.US_ASCII), CoreMatchers .equalTo(Arrays.asList("mydomain.com\tTRUE\t/\tTRUE\t" + expectedExpiration + "\tkey2\tvalue"))); @@ -136,8 +136,7 @@ public class NetscapeCookieFileTest { String expectedExpiration = String .valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000)); - Assert.assertThat( - Files.readAllLines(tmpFile, StandardCharsets.US_ASCII), + assertThat(Files.readAllLines(tmpFile, StandardCharsets.US_ASCII), CoreMatchers.equalTo( Arrays.asList("domain.com\tTRUE\t/my/path\tFALSE\t" + expectedExpiration + "\tkey2\tvalue2"))); @@ -154,7 +153,7 @@ public class NetscapeCookieFileTest { // now imitate another process/thread holding the lock file LockFile lockFile = new LockFile(tmpFile.toFile()); try { - Assert.assertTrue("Could not acquire lock", lockFile.lock()); + assertTrue("Could not acquire lock", lockFile.lock()); cookieFile.write(baseUrl); } finally { lockFile.unlock(); @@ -184,7 +183,7 @@ public class NetscapeCookieFileTest { List lines = Files.readAllLines(tmpFile, StandardCharsets.US_ASCII); - Assert.assertEquals("Expected 3 lines", 3, lines.size()); + assertEquals("Expected 3 lines", 3, lines.size()); assertStringMatchesPatternWithInexactNumber(lines.get(0), "some-domain1\tTRUE\t/some/path1\tFALSE\t(\\d*)\tkey1\tvalueFromSimple2", JAN_01_2030_NOON, 1000); @@ -202,12 +201,12 @@ public class NetscapeCookieFileTest { long delta) { java.util.regex.Matcher matcher = Pattern.compile(pattern) .matcher(string); - Assert.assertTrue("Given string '" + string + "' does not match '" - + pattern + "'", matcher.matches()); + assertTrue("Given string '" + string + "' does not match '" + pattern + + "'", matcher.matches()); // extract numeric value Long actualNumericValue = Long.decode(matcher.group(1)); - Assert.assertTrue( + assertTrue( "Value is supposed to be close to " + expectedNumericValue + " but is " + actualNumericValue + ".", Math.abs(expectedNumericValue - actualNumericValue) <= delta); @@ -238,8 +237,7 @@ public class NetscapeCookieFileTest { } Set actualCookies = new NetscapeCookieFile(tmpFile, creationDate).getCookies(true); - Assert.assertThat(actualCookies, - HttpCookiesMatcher.containsInOrder(cookies)); + assertThat(actualCookies, HttpCookiesMatcher.containsInOrder(cookies)); } @Test @@ -259,8 +257,7 @@ public class NetscapeCookieFileTest { NetscapeCookieFile.write(writer, cookies, baseUrl, creationDate); } // compare original file with newly written one, they should not differ - Assert.assertEquals(Files.readAllLines(tmpFile), - Files.readAllLines(tmpFile2)); + assertEquals(Files.readAllLines(tmpFile), Files.readAllLines(tmpFile2)); } @Test @@ -289,8 +286,7 @@ public class NetscapeCookieFileTest { Set actualCookies = new NetscapeCookieFile(tmpFile, creationDate) .getCookies(true); - Assert.assertThat(actualCookies, - HttpCookiesMatcher.containsInOrder(cookies)); + assertThat(actualCookies, HttpCookiesMatcher.containsInOrder(cookies)); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java index 32dc7eb12..cec69c499 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java @@ -11,12 +11,12 @@ package org.eclipse.jgit.lib; import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java index b55c91f34..965a2faf8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java @@ -10,8 +10,8 @@ package org.eclipse.jgit.transport; import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java index e16b84fec..f9300cd0f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java @@ -9,12 +9,12 @@ */ package org.eclipse.jgit.transport; +import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasItems; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java index 7fe5b5981..b84b6b2e0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java @@ -9,6 +9,8 @@ */ package org.eclipse.jgit.transport; +import static org.hamcrest.MatcherAssert.assertThat; + import java.io.File; import java.io.IOException; import java.net.HttpCookie; @@ -120,7 +122,7 @@ public class TransportHttpTest extends SampleDataRepositoryTestCase { cookie.setMaxAge(1234); expectedCookies.add(cookie); - Assert.assertThat( + assertThat( new NetscapeCookieFile(cookieFile.toPath()) .getCookies(true), HttpCookiesMatcher.containsInOrder(expectedCookies, 5)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java index d113eabd8..8b4c05b80 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java @@ -9,9 +9,9 @@ */ package org.eclipse.jgit.transport; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackRefSortingForReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackRefSortingForReachabilityTest.java index 99fe214cd..37c87057d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackRefSortingForReachabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackRefSortingForReachabilityTest.java @@ -10,8 +10,8 @@ package org.eclipse.jgit.transport; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; -import static org.junit.Assert.assertThat; import java.util.List; import java.util.stream.Collectors; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 052cb14bf..ea86563da 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -1,5 +1,6 @@ package org.eclipse.jgit.transport; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItems; @@ -8,7 +9,6 @@ import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/LRUMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/LRUMapTest.java index f6dd9adc0..c9fd0c9b1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/LRUMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/LRUMapTest.java @@ -9,11 +9,12 @@ */ package org.eclipse.jgit.util; +import static org.hamcrest.MatcherAssert.assertThat; + import java.util.LinkedHashMap; import java.util.Map; import org.hamcrest.collection.IsIterableContainingInOrder; -import org.junit.Assert; import org.junit.Test; public class LRUMapTest { @@ -38,8 +39,7 @@ public class LRUMapTest { expectedMap.put(0, 0); expectedMap.put(3, 3); - Assert.assertThat(map.entrySet(), - IsIterableContainingInOrder - .contains(expectedMap.entrySet().toArray())); + assertThat(map.entrySet(), IsIterableContainingInOrder + .contains(expectedMap.entrySet().toArray())); } } From b5cabfbff207c30cff0b082d0aed553b5ae8a785 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 23 Jan 2020 00:49:35 +0100 Subject: [PATCH 07/22] Add org.assertj 3.14.0.v20200120-1926 to target platform This will be used by JGit based NIO2 filesystem implementation in Ic8712a091e3941634c80b19ba0e316d9c98dae3e. CQ: 21437 Change-Id: I64f8415826e95bff7cf93e7fd28e00f0809b500c Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.10.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.11.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.12.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.13.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.14-staging.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.6.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.7.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.8.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.9.target | 4 +++- .../org.eclipse.jgit.target/orbit/I20200120214610.tpd | 2 ++ 10 files changed, 29 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 27c1bf641..09f92c236 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index d1046cd41..d77379bd4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index a2aa362ba..f9e471545 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index 72f1f0b85..f9024fa1f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index e91c4747c..7d4f5918a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 661085dad..a3e55b77c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 3cfe837b9..355b37359 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index 289111545..15198f28b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index c6ee0a165..c76ddede2 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -57,6 +57,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd index 3cf7d4c40..33d72610a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd @@ -36,6 +36,8 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/I202001202146 org.apache.sshd.osgi.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127] org.apache.sshd.sftp [2.2.0.v20190425-2127,2.2.0.v20190425-2127] org.apache.sshd.sftp.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127] + org.assertj [3.14.0.v20200120-1926,3.14.0.v20200120-1926] + org.assertj.source [3.14.0.v20200120-1926,3.14.0.v20200120-1926] org.bouncycastle.bcpg [1.64.0.v20191109-0815,1.64.0.v20191109-0815] org.bouncycastle.bcpg.source [1.64.0.v20191109-0815,1.64.0.v20191109-0815] org.bouncycastle.bcpkix [1.64.0.v20191109-0815,1.64.0.v20191109-0815] From 8ada9048c5add754c3b34851b1bd501ce28b3321 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 22 Jan 2020 00:48:24 +0100 Subject: [PATCH 08/22] Replace ExpectedException which was deprecated in junit 4.13 Change-Id: I64b0c057dd0a12aef2f3d56fa0c8a10e3b23fffd Signed-off-by: Matthias Sohn --- WORKSPACE | 6 + lib/BUILD | 9 + .../http/test/SmartClientSmartServerTest.java | 26 +-- .../jgit/lfs/server/fs/DownloadTest.java | 26 +-- .../tst/org/eclipse/jgit/pgm/BlameTest.java | 26 +-- org.eclipse.jgit.test/BUILD | 1 + org.eclipse.jgit.test/META-INF/MANIFEST.MF | 2 + org.eclipse.jgit.test/pom.xml | 5 + .../jgit/api/RenameBranchCommandTest.java | 10 +- .../storage/dfs/DfsBlockCacheConfigTest.java | 13 +- .../storage/file/FileReftableStackTest.java | 13 +- .../storage/file/ObjectDirectoryTest.java | 17 +- .../storage/file/T0003_BasicTest.java | 13 +- .../tst/org/eclipse/jgit/lib/ConfigTest.java | 70 +++--- .../eclipse/jgit/lib/ObjectCheckerTest.java | 20 +- .../jgit/transport/BundleWriterTest.java | 19 +- .../jgit/transport/ProtocolV2ParserTest.java | 14 +- .../transport/RequestValidatorTestCase.java | 206 +++++++++--------- .../transport/UploadPackReachabilityTest.java | 5 - .../jgit/util/RawParseUtils_LineMapTest.java | 10 +- pom.xml | 5 + 21 files changed, 237 insertions(+), 279 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 8c3c27f75..f456e4c31 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -177,6 +177,12 @@ maven_jar( sha1 = "497ddb32fd5d01f9dbe99a2ec790aeb931dff1b1", ) +maven_jar( + name = "assertj-core", + artifact = "org.assertj:assertj-core:3.14.0", + sha1 = "3b7b0fcac821f3d167764e9926573cd64f78f9e9", +) + BYTE_BUDDY_VERSION = "1.9.0" maven_jar( diff --git a/lib/BUILD b/lib/BUILD index 058899fce..6c974865e 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -213,6 +213,15 @@ java_library( ], ) +java_library( + name = "assertj-core", + testonly = 1, + visibility = ["//visibility:public"], + exports = [ + "@assertj-core//jar", + ], +) + java_library( name = "servlet-api", visibility = [ diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java index 9a7c0776a..51a7a8ddc 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java @@ -18,6 +18,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -88,18 +89,12 @@ import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.eclipse.jgit.transport.http.HttpConnectionFactory; import org.eclipse.jgit.util.HttpSupport; import org.eclipse.jgit.util.SystemReader; -import org.hamcrest.Matchers; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase { private static final String HDR_TRANSFER_ENCODING = "Transfer-Encoding"; - @Rule - public ExpectedException thrown = ExpectedException.none(); - private AdvertiseRefsHook advertiseRefsHook; private Repository remoteRepository; @@ -462,11 +457,12 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase { try (Repository dst = createBareRepository(); Transport t = Transport.open(dst, remoteURI)) { assertFalse(dst.getObjectDatabase().has(A_txt)); - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( + Exception e = assertThrows(TransportException.class, + () -> t.fetch(NullProgressMonitor.INSTANCE, + Collections.singletonList( + new RefSpec(unreachableCommit.name())))); + assertTrue(e.getMessage().contains( "want " + unreachableCommit.name() + " not valid")); - t.fetch(NullProgressMonitor.INSTANCE, Collections - .singletonList(new RefSpec(unreachableCommit.name()))); } } @@ -484,11 +480,11 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase { try (Repository dst = createBareRepository(); Transport t = Transport.open(dst, remoteURI)) { assertFalse(dst.getObjectDatabase().has(A_txt)); - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + A.name() + " not valid")); - t.fetch(NullProgressMonitor.INSTANCE, Collections - .singletonList(new RefSpec(A.name()))); + Exception e = assertThrows(TransportException.class, + () -> t.fetch(NullProgressMonitor.INSTANCE, + Collections.singletonList(new RefSpec(A.name())))); + assertTrue( + e.getMessage().contains("want " + A.name() + " not valid")); } } diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java index d29541449..8d32f9e75 100644 --- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java +++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java @@ -12,6 +12,7 @@ package org.eclipse.jgit.lfs.server.fs; import static org.apache.http.HttpStatus.SC_NOT_FOUND; import static org.apache.http.HttpStatus.SC_UNPROCESSABLE_ENTITY; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import java.io.IOException; import java.nio.file.Path; @@ -22,15 +23,10 @@ import org.apache.http.client.ClientProtocolException; import org.eclipse.jgit.lfs.lib.AnyLongObjectId; import org.eclipse.jgit.lfs.test.LongObjectIdTestUtils; import org.eclipse.jgit.util.FileUtils; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class DownloadTest extends LfsServerTest { - @Rule - public ExpectedException exception = ExpectedException.none(); - @Test public void testDownload() throws Exception { String TEXT = "test"; @@ -49,10 +45,8 @@ public class DownloadTest extends LfsServerTest { Path f = Paths.get(getTempDirectory().toString(), "download"); String error = String.format( "Invalid pathInfo: '/%s' does not match '/{SHA-256}'", id); - exception.expect(RuntimeException.class); - exception.expectMessage( - formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error)); - getContent(id, f); + assertThrows(formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error), + RuntimeException.class, () -> getContent(id, f)); } @Test @@ -62,22 +56,18 @@ public class DownloadTest extends LfsServerTest { String id = putContent(TEXT).name().replace('f', 'z'); Path f = Paths.get(getTempDirectory().toString(), "download"); String error = String.format("Invalid id: %s", id); - exception.expect(RuntimeException.class); - exception.expectMessage( - formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error)); - getContent(id, f); + assertThrows(formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error), + RuntimeException.class, () -> getContent(id, f)); } @Test - public void testDownloadNotFound() - throws ClientProtocolException, IOException { + public void testDownloadNotFound() { String TEXT = "test"; AnyLongObjectId id = LongObjectIdTestUtils.hash(TEXT); Path f = Paths.get(getTempDirectory().toString(), "download"); String error = String.format("Object '%s' not found", id.getName()); - exception.expect(RuntimeException.class); - exception.expectMessage(formatErrorMessage(SC_NOT_FOUND, error)); - getContent(id, f); + assertThrows(formatErrorMessage(SC_NOT_FOUND, error), + RuntimeException.class, () -> getContent(id, f)); } @SuppressWarnings("boxing") diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java index 006039bdc..ea3043358 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java @@ -9,6 +9,7 @@ */ package org.eclipse.jgit.pgm; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import org.eclipse.jgit.api.Git; @@ -17,24 +18,18 @@ import org.eclipse.jgit.lib.CLIRepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.revwalk.RevCommit; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class BlameTest extends CLIRepositoryTestCase { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void testBlameNoHead() throws Exception { try (Git git = new Git(db)) { writeTrashFile("inIndex.txt", "index"); git.add().addFilepattern("inIndex.txt").call(); } - thrown.expect(Die.class); - thrown.expectMessage("no such ref: HEAD"); - execute("git blame inIndex.txt"); + assertThrows("no such ref: HEAD", Die.class, + () -> execute("git blame inIndex.txt")); } @Test @@ -68,9 +63,8 @@ public class BlameTest extends CLIRepositoryTestCase { git.commit().setMessage("initial commit").call(); } writeTrashFile("onlyInWorkingTree.txt", "not in repo"); - thrown.expect(Die.class); - thrown.expectMessage("no such path 'onlyInWorkingTree.txt' in HEAD"); - execute("git blame onlyInWorkingTree.txt"); + assertThrows("no such path 'onlyInWorkingTree.txt' in HEAD", Die.class, + () -> execute("git blame onlyInWorkingTree.txt")); } @Test @@ -78,9 +72,8 @@ public class BlameTest extends CLIRepositoryTestCase { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); } - thrown.expect(Die.class); - thrown.expectMessage("no such path 'does_not_exist.txt' in HEAD"); - execute("git blame does_not_exist.txt"); + assertThrows("no such path 'does_not_exist.txt' in HEAD", Die.class, + () -> execute("git blame does_not_exist.txt")); } @Test @@ -88,9 +81,8 @@ public class BlameTest extends CLIRepositoryTestCase { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); } - thrown.expect(Die.class); - thrown.expectMessage("no such path 'sub/does_not_exist.txt' in HEAD"); - execute("git blame sub/does_not_exist.txt"); + assertThrows("no such path 'sub/does_not_exist.txt' in HEAD", Die.class, + () -> execute("git blame sub/does_not_exist.txt")); } @Test diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD index 3d487960c..b34ef2a79 100644 --- a/org.eclipse.jgit.test/BUILD +++ b/org.eclipse.jgit.test/BUILD @@ -55,6 +55,7 @@ java_library( srcs = HELPERS, resources = DATA, deps = [ + "//lib:assertj-core", "//lib:jsch", "//lib:junit", "//lib:mockito", diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF index 509ef0b05..18f16d91f 100644 --- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)", org.apache.commons.compress.compressors.bzip2;version="[1.15.0,2.0)", org.apache.commons.compress.compressors.gzip;version="[1.15.0,2.0)", org.apache.commons.compress.compressors.xz;version="[1.15.0,2.0)", + org.assertj.core.api;version="[3.14.0,4.0.0)", org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)", org.eclipse.jgit.annotations;version="[5.7.0,5.8.0)", org.eclipse.jgit.api;version="[5.7.0,5.8.0)", @@ -72,6 +73,7 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)", org.eclipse.jgit.util.sha1;version="[5.7.0,5.8.0)", org.junit;version="[4.13,5.0.0)", org.junit.experimental.theories;version="[4.13,5.0.0)", + org.junit.function;version="[4.13.0,5.0.0)", org.junit.rules;version="[4.13,5.0.0)", org.junit.runner;version="[4.13,5.0.0)", org.junit.runners;version="[4.13,5.0.0)", diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml index 60e6818dc..7ba19d4ef 100644 --- a/org.eclipse.jgit.test/pom.xml +++ b/org.eclipse.jgit.test/pom.xml @@ -65,6 +65,11 @@ [1.1.0,2.0.0) + + org.assertj + assertj-core + + org.mockito mockito-core diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java index 6f7ec9a44..534ebd9c6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java @@ -14,6 +14,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import org.eclipse.jgit.api.errors.RefAlreadyExistsException; @@ -25,9 +26,7 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.revwalk.RevCommit; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; /** * Unit tests of {@link RenameBranchCommand} @@ -40,9 +39,6 @@ public class RenameBranchCommandTest extends RepositoryTestCase { private Git git; - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Override @Before public void setUp() throws Exception { @@ -57,8 +53,8 @@ public class RenameBranchCommandTest extends RepositoryTestCase { @Test public void renameToExisting() throws Exception { assertNotNull(git.branchCreate().setName("foo").call()); - thrown.expect(RefAlreadyExistsException.class); - git.branchRename().setOldName("master").setNewName("foo").call(); + assertThrows(RefAlreadyExistsException.class, () -> git.branchRename() + .setOldName("master").setNewName("foo").call()); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfigTest.java index e612061ab..2df0ba1b0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfigTest.java @@ -40,23 +40,18 @@ package org.eclipse.jgit.internal.storage.dfs; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThrows; import org.eclipse.jgit.internal.JGitText; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class DfsBlockCacheConfigTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void blockSizeNotPowerOfTwoExpectsException() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage(is(JGitText.get().blockSizeNotPowerOf2)); - - new DfsBlockCacheConfig().setBlockSize(1000); + assertThrows(JGitText.get().blockSizeNotPowerOf2, + IllegalArgumentException.class, + () -> new DfsBlockCacheConfig().setBlockSize(1000)); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableStackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableStackTest.java index 770991e51..72bff1683 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableStackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableStackTest.java @@ -12,6 +12,7 @@ package org.eclipse.jgit.internal.storage.file; import static org.eclipse.jgit.lib.Ref.Storage.PACKED; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.File; @@ -21,6 +22,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; + import org.eclipse.jgit.internal.storage.file.FileReftableStack.Segment; import org.eclipse.jgit.internal.storage.reftable.MergedReftable; import org.eclipse.jgit.internal.storage.reftable.RefCursor; @@ -31,9 +33,7 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.util.FileUtils; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class FileReftableStackTest { @@ -113,9 +113,6 @@ public class FileReftableStackTest { testCompaction(1024); } - @Rule - public final ExpectedException thrown = ExpectedException.none(); - @SuppressWarnings({ "resource", "unused" }) @Test public void missingReftable() throws Exception { @@ -143,9 +140,9 @@ public class FileReftableStackTest { } } } - thrown.expect(FileNotFoundException.class); - new FileReftableStack(new File(reftableDir, "refs"), reftableDir, null, - () -> new Config()); + assertThrows(FileNotFoundException.class, + () -> new FileReftableStack(new File(reftableDir, "refs"), + reftableDir, null, () -> new Config())); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java index 97c56385b..d269457eb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java @@ -44,6 +44,7 @@ package org.eclipse.jgit.internal.storage.file; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.File; @@ -67,15 +68,10 @@ import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.storage.file.FileBasedConfig; import org.eclipse.jgit.util.FS; import org.junit.Assume; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class ObjectDirectoryTest extends RepositoryTestCase { - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - @Test public void testConcurrentInsertionOfBlobsToTheSameNewFanOutDirectory() throws Exception { @@ -199,8 +195,7 @@ public class ObjectDirectoryTest extends RepositoryTestCase { } @Test - public void testShallowFileCorrupt() - throws Exception { + public void testShallowFileCorrupt() throws Exception { FileRepository repository = createBareRepository(); ObjectDirectory dir = repository.getObjectDatabase(); @@ -210,11 +205,9 @@ public class ObjectDirectoryTest extends RepositoryTestCase { UTF_8.name())) { writer.println(commit); } - - expectedEx.expect(IOException.class); - expectedEx.expectMessage(MessageFormat - .format(JGitText.get().badShallowLine, commit)); - dir.getShallowCommits(); + assertThrows( + MessageFormat.format(JGitText.get().badShallowLine, commit), + IOException.class, () -> dir.getShallowCommits()); } private Collection> blobInsertersForTheSameFanOutDir( diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java index a6a8a17b2..49e8a7be6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -53,13 +54,9 @@ import org.eclipse.jgit.test.resources.SampleDataRepositoryTestCase; import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.IO; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class T0003_BasicTest extends SampleDataRepositoryTestCase { - @Rule - public ExpectedException expectedException = ExpectedException.none(); @Test public void test001_Initalize() { @@ -311,10 +308,10 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase { // We won't create a tree entry with an empty filename // final TreeFormatter formatter = new TreeFormatter(); - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage(JGitText.get().invalidTreeZeroLengthName); - formatter.append("", FileMode.TREE, - ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")); + assertThrows(JGitText.get().invalidTreeZeroLengthName, + IllegalArgumentException.class, + () -> formatter.append("", FileMode.TREE, ObjectId.fromString( + "4b825dc642cb6eb9a060e54bf8d69288fbee4904"))); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index a80d8b377..9b5691775 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -58,7 +59,6 @@ import org.eclipse.jgit.util.SystemReader; import org.junit.After; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; /** @@ -75,9 +75,6 @@ public class ConfigTest { private static final String REFS_BACKUP = "+refs/heads/*:refs/remotes/backup/*"; - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - @Rule public TemporaryFolder tmp = new TemporaryFolder(); @@ -721,24 +718,22 @@ public class ConfigTest { } @Test - public void testIncludeInvalidName() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage(JGitText.get().invalidLineInConfigFile); - parse("[include]\nbar\n"); + public void testIncludeInvalidName() { + assertThrows(JGitText.get().invalidLineInConfigFile, + ConfigInvalidException.class, () -> parse("[include]\nbar\n")); } @Test - public void testIncludeNoValue() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage(JGitText.get().invalidLineInConfigFile); - parse("[include]\npath\n"); + public void testIncludeNoValue() { + assertThrows(JGitText.get().invalidLineInConfigFile, + ConfigInvalidException.class, () -> parse("[include]\npath\n")); } @Test - public void testIncludeEmptyValue() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage(JGitText.get().invalidLineInConfigFile); - parse("[include]\npath=\n"); + public void testIncludeEmptyValue() { + assertThrows(JGitText.get().invalidLineInConfigFile, + ConfigInvalidException.class, + () -> parse("[include]\npath=\n")); } @Test @@ -1269,25 +1264,24 @@ public class ConfigTest { } @Test - public void testTimeUnitInvalid() throws ConfigInvalidException { - expectedEx.expect(IllegalArgumentException.class); - expectedEx - .expectMessage("Invalid time unit value: a.a=1 monttthhh"); - parseTime("1 monttthhh", DAYS); + public void testTimeUnitInvalid() { + assertThrows("Invalid time unit value: a.a=1 monttthhh", + IllegalArgumentException.class, + () -> parseTime("1 monttthhh", DAYS)); } @Test public void testTimeUnitInvalidWithSection() throws ConfigInvalidException { Config c = parse("[a \"b\"]\na=1 monttthhh\n"); - expectedEx.expect(IllegalArgumentException.class); - expectedEx.expectMessage("Invalid time unit value: a.b.a=1 monttthhh"); - c.getTimeUnit("a", "b", "a", 0, DAYS); + assertThrows("Invalid time unit value: a.b.a=1 monttthhh", + IllegalArgumentException.class, + () -> c.getTimeUnit("a", "b", "a", 0, DAYS)); } @Test - public void testTimeUnitNegative() throws ConfigInvalidException { - expectedEx.expect(IllegalArgumentException.class); - parseTime("-1", MILLISECONDS); + public void testTimeUnitNegative() { + assertThrows(IllegalArgumentException.class, + () -> parseTime("-1", MILLISECONDS)); } @Test @@ -1430,10 +1424,10 @@ public class ConfigTest { } @Test - public void testInvalidGroupHeader() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage(JGitText.get().badGroupHeader); - parse("[foo \"bar\" ]\nfoo=bar\n"); + public void testInvalidGroupHeader() { + assertThrows(JGitText.get().badGroupHeader, + ConfigInvalidException.class, + () -> parse("[foo \"bar\" ]\nfoo=bar\n")); } @Test @@ -1447,17 +1441,15 @@ public class ConfigTest { } @Test - public void testCrCharContinuation() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage("Bad escape: \\u000d"); - parseEscapedValue("tr\\\rue"); + public void testCrCharContinuation() { + assertThrows("Bad escape: \\u000d", ConfigInvalidException.class, + () -> parseEscapedValue("tr\\\rue")); } @Test - public void testCrEOFContinuation() throws ConfigInvalidException { - expectedEx.expect(ConfigInvalidException.class); - expectedEx.expectMessage("Bad escape: \\u000d"); - parseEscapedValue("tr\\\r"); + public void testCrEOFContinuation() { + assertThrows("Bad escape: \\u000d", ConfigInvalidException.class, + () -> parseEscapedValue("tr\\\r")); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java index 11ed8fdf0..5c44c9c44 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java @@ -34,6 +34,7 @@ import static org.eclipse.jgit.lib.ObjectChecker.ErrorType.ZERO_PADDED_FILEMODE; import static org.eclipse.jgit.util.RawParseUtils.decode; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.fail; import java.text.MessageFormat; @@ -41,9 +42,7 @@ import java.text.MessageFormat; import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.internal.JGitText; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class ObjectCheckerTest { private static final ObjectChecker SECRET_KEY_CHECKER = new ObjectChecker() { @@ -84,9 +83,6 @@ public class ObjectCheckerTest { private ObjectChecker checker; - @Rule - public final ExpectedException thrown = ExpectedException.none(); - @Before public void setUp() throws Exception { checker = new ObjectChecker(); @@ -116,9 +112,9 @@ public class ObjectCheckerTest { } @Test - public void testCheckBlobCorrupt() throws CorruptObjectException { - thrown.expect(CorruptObjectException.class); - SECRET_KEY_CHECKER.check(OBJ_BLOB, encodeASCII("key = \"secret_key\"")); + public void testCheckBlobCorrupt() { + assertThrows(CorruptObjectException.class, () -> SECRET_KEY_CHECKER + .check(OBJ_BLOB, encodeASCII("key = \"secret_key\""))); } @Test @@ -129,11 +125,9 @@ public class ObjectCheckerTest { } @Test - public void testCheckBlobWithBlobObjectCheckerCorrupt() - throws CorruptObjectException { - thrown.expect(CorruptObjectException.class); - SECRET_KEY_BLOB_CHECKER.check(OBJ_BLOB, - encodeASCII("key = \"secret_key\"")); + public void testCheckBlobWithBlobObjectCheckerCorrupt() { + assertThrows(CorruptObjectException.class, () -> SECRET_KEY_BLOB_CHECKER + .check(OBJ_BLOB, encodeASCII("key = \"secret_key\""))); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java index b5ab9d2ac..054eb9c5a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java @@ -17,6 +17,7 @@ import static org.eclipse.jgit.lib.Constants.OBJ_BLOB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -44,36 +45,30 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.test.resources.SampleDataRepositoryTestCase; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class BundleWriterTest extends SampleDataRepositoryTestCase { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void testEmptyBundleFails() throws Exception { Repository newRepo = createBareRepository(); - thrown.expect(TransportException.class); - fetchFromBundle(newRepo, new byte[0]); + assertThrows(TransportException.class, + () -> fetchFromBundle(newRepo, new byte[0])); } @Test public void testNonBundleFails() throws Exception { Repository newRepo = createBareRepository(); - thrown.expect(TransportException.class); - fetchFromBundle(newRepo, "Not a bundle file".getBytes(UTF_8)); + assertThrows(TransportException.class, () -> fetchFromBundle(newRepo, + "Not a bundle file".getBytes(UTF_8))); } @Test public void testGarbageBundleFails() throws Exception { Repository newRepo = createBareRepository(); - thrown.expect(TransportException.class); - fetchFromBundle(newRepo, + assertThrows(TransportException.class, () -> fetchFromBundle(newRepo, (TransportBundle.V2_BUNDLE_SIGNATURE + '\n' + "Garbage") - .getBytes(UTF_8)); + .getBytes(UTF_8))); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java index f9300cd0f..038ce717b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java @@ -14,6 +14,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasItems; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; @@ -27,15 +28,10 @@ import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.revwalk.RevCommit; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class ProtocolV2ParserTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - private TestRepository testRepo; @Before @@ -236,8 +232,8 @@ public class ProtocolV2ParserTest { ProtocolV2Parser parser = new ProtocolV2Parser( ConfigBuilder.start().allowFilter().done()); - thrown.expect(PackProtocolException.class); - parser.parseFetchRequest(pckIn); + assertThrows(PackProtocolException.class, + () -> parser.parseFetchRequest(pckIn)); } @Test @@ -247,8 +243,8 @@ public class ProtocolV2ParserTest { ProtocolV2Parser parser = new ProtocolV2Parser( ConfigBuilder.getDefault()); - thrown.expect(PackProtocolException.class); - parser.parseFetchRequest(pckIn); + assertThrows(PackProtocolException.class, + () -> parser.parseFetchRequest(pckIn)); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java index f15fa4864..cc910b3b9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java @@ -9,12 +9,15 @@ */ package org.eclipse.jgit.transport; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowableOfType; + import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.eclipse.jgit.errors.PackProtocolException; +import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.internal.storage.dfs.DfsGarbageCollector; import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription; @@ -25,17 +28,11 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.transport.UploadPack.RequestValidator; -import org.hamcrest.Matchers; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public abstract class RequestValidatorTestCase { - @Rule - public ExpectedException thrown = ExpectedException.none(); - private RevCommit reachableCommit; private RevCommit tipAdvertisedCommit; @@ -111,156 +108,165 @@ public abstract class RequestValidatorTestCase { protected abstract boolean isUnreachableBlobValid(); @Test - public void validateReachableCommitWithBitmaps() - throws PackProtocolException, IOException { + public void validateReachableCommitWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(reachableCommit)); if (!isReachableCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers - .containsString( - "want " + reachableCommit.name() + " not valid")); - + assertTransportException(c, + "want " + reachableCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(reachableCommit)); + c.call(); } @Test - public void validateReachableCommitWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateReachableCommitWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(reachableCommit)); if (!isReachableCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + reachableCommit.name() + " not valid")); - + assertTransportException(c, + "want " + reachableCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(reachableCommit)); + c.call(); } @Test - public void validateAdvertisedTipWithBitmaps() - throws PackProtocolException, IOException { + public void validateAdvertisedTipWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(tipAdvertisedCommit)); if (!isAdvertisedTipValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + tipAdvertisedCommit.name() + " not valid")); - + assertTransportException(c, + "want " + tipAdvertisedCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(tipAdvertisedCommit)); + c.call(); } @Test - public void validateAdvertisedTipWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateAdvertisedTipWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(tipAdvertisedCommit)); if (!isAdvertisedTipValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + tipAdvertisedCommit.name() + " not valid")); - + assertTransportException(c, + "want " + tipAdvertisedCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(tipAdvertisedCommit)); + c.call(); } @Test - public void validateUnadvertisedTipWithBitmaps() - throws PackProtocolException, IOException { + public void validateUnadvertisedTipWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(tipUnadvertisedCommit)); if (!isUnadvertisedTipCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + tipUnadvertisedCommit.name() + " not valid")); - + assertTransportException(c, + "want " + tipUnadvertisedCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(tipUnadvertisedCommit)); + c.call(); } @Test - public void validateUnadvertisedTipWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateUnadvertisedTipWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(tipUnadvertisedCommit)); if (!isUnadvertisedTipCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + tipUnadvertisedCommit.name() + " not valid")); - + assertTransportException(c, + "want " + tipUnadvertisedCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(tipUnadvertisedCommit)); + c.call(); } @Test - public void validateUnreachableCommitWithBitmaps() - throws PackProtocolException, IOException { + public void validateUnreachableCommitWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(unreachableCommit)); if (!isUnreachableCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + unreachableCommit.name() + " not valid")); - + assertTransportException(c, + "want " + unreachableCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(unreachableCommit)); + c.call(); } @Test - public void validateUnreachableCommitWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateUnreachableCommitWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(unreachableCommit)); if (!isUnreachableCommitValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + unreachableCommit.name() + " not valid")); - + assertTransportException(c, + "want " + unreachableCommit.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(unreachableCommit)); + c.call(); } @Test - public void validateReachableBlobWithBitmaps() - throws PackProtocolException, IOException { + public void validateReachableBlobWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(reachableBlob)); if (!isReachableBlobValid_withBitmaps()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + reachableBlob.name() + " not valid")); + assertTransportException(c, + "want " + reachableBlob.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(reachableBlob)); + c.call(); } @Test - public void validateReachableBlobWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateReachableBlobWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(reachableBlob)); if (!isReachableBlobValid_withoutBitmaps()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + reachableBlob.name() + " not valid")); + assertTransportException(c, + "want " + reachableBlob.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(reachableBlob)); + c.call(); } @Test - public void validateUnreachableBlobWithBitmaps() - throws PackProtocolException, IOException { + public void validateUnreachableBlobWithBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithBitmaps()), + Arrays.asList(unreachableBlob)); if (!isUnreachableBlobValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + unreachableBlob.name() + " not valid")); + assertTransportException(c, + "want " + unreachableBlob.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithBitmaps()), - Arrays.asList(unreachableBlob)); + c.call(); } @Test - public void validateUnreachableBlobWithoutBitmaps() - throws PackProtocolException, IOException { + public void validateUnreachableBlobWithoutBitmaps() throws Throwable { + ThrowingCallable c = () -> createValidator().checkWants( + getUploadPack(getRepoWithoutBitmaps()), + Arrays.asList(unreachableBlob)); if (!isUnreachableBlobValid()) { - thrown.expect(TransportException.class); - thrown.expectMessage(Matchers.containsString( - "want " + unreachableBlob.name() + " not valid")); + assertTransportException(c, + "want " + unreachableBlob.name() + " not valid"); + return; } - createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()), - Arrays.asList(unreachableBlob)); + c.call(); + } + + private void assertTransportException(ThrowingCallable c, + String messageContent) throws AssertionError { + assertThat(catchThrowableOfType(c, TransportException.class)) + .hasMessageContaining(messageContent); } private UploadPack getUploadPack(Repository repository) throws IOException { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java index 8b4c05b80..271176264 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java @@ -32,9 +32,7 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.UploadPackFactory; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; /** * Test combinations of: @@ -46,9 +44,6 @@ import org.junit.rules.ExpectedException; */ public class UploadPackReachabilityTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - private URIish uri; private TestProtocol testProtocol; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_LineMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_LineMapTest.java index 7ea96dd9d..1c2d8d7f6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_LineMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_LineMapTest.java @@ -13,16 +13,12 @@ package org.eclipse.jgit.util; import static java.nio.charset.StandardCharsets.ISO_8859_1; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import org.eclipse.jgit.errors.BinaryBlobException; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class RawParseUtils_LineMapTest { - @Rule - public ExpectedException exception = ExpectedException.none(); - @Test public void testEmpty() throws Exception { @@ -62,8 +58,8 @@ public class RawParseUtils_LineMapTest { @Test public void testLineMapOrBinary() throws Exception { final byte[] buf = "xxxfoo\nb\0ar".getBytes(ISO_8859_1); - exception.expect(BinaryBlobException.class); - RawParseUtils.lineMapOrBinary(buf, 3, buf.length); + assertThrows(BinaryBlobException.class, + () -> RawParseUtils.lineMapOrBinary(buf, 3, buf.length)); } @Test diff --git a/pom.xml b/pom.xml index 6cf7b3592..0e1e98fa6 100644 --- a/pom.xml +++ b/pom.xml @@ -775,6 +775,11 @@ ${bouncycastle-version} + + org.assertj + assertj-core + 3.14.0 + From fc7b0031631b7af01f44b5d36b7f9f0fab23bf9f Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 11 Jan 2020 00:26:35 +0100 Subject: [PATCH 09/22] ReceivePack: enable overriding filterCommands and executeCommands Change-Id: Ib923e137f0fadd876434bcc49ebd0c9a4d90b45c Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/transport/ReceivePack.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 8ca09f8ad..24cd8f3df 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -1725,15 +1725,17 @@ public class ReceivePack { * desired status to filter by. * @return a copy of the command list containing only those commands with * the desired status. + * @since 5.7 */ - private List filterCommands(Result want) { + protected List filterCommands(Result want) { return ReceiveCommand.filter(commands, want); } /** * Execute commands to update references. + * @since 5.7 */ - private void executeCommands() { + protected void executeCommands() { List toApply = filterCommands(Result.NOT_ATTEMPTED); if (toApply.isEmpty()) return; From 8fa3594565d43c81d5e1a34660b29a861b81d43a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 24 Jan 2020 16:49:14 +0900 Subject: [PATCH 10/22] Remove Error-Prone ExpectedExceptionChecker The checker only checks for misuse of ExpectedException. Since we've moved to JUnit 4.13 and assertThrows, ExpectedException won't be used at all, so now we can get rid of that setting. Change-Id: Ia9189936ae215110f1f5fc6459c5dbc944404ade Signed-off-by: David Pursehouse --- org.eclipse.jgit.benchmarks/pom.xml | 3 --- pom.xml | 3 --- tools/BUILD | 1 - 3 files changed, 7 deletions(-) diff --git a/org.eclipse.jgit.benchmarks/pom.xml b/org.eclipse.jgit.benchmarks/pom.xml index 426fb7ffe..5e707719e 100644 --- a/org.eclipse.jgit.benchmarks/pom.xml +++ b/org.eclipse.jgit.benchmarks/pom.xml @@ -69,9 +69,6 @@ javac-with-errorprone true - - -Xep:ExpectedExceptionChecker:ERROR - diff --git a/pom.xml b/pom.xml index 0e1e98fa6..06e2f308a 100644 --- a/pom.xml +++ b/pom.xml @@ -836,9 +836,6 @@ javac-with-errorprone true - - -Xep:ExpectedExceptionChecker:ERROR - org/eclipse/jgit/transport/InsecureCipherFactory.java diff --git a/tools/BUILD b/tools/BUILD index e5931dc8c..d66837700 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -39,7 +39,6 @@ java_package_configuration( "-Xep:ElementsCountedInLoop:ERROR", "-Xep:EqualsHashCode:ERROR", "-Xep:EqualsIncompatibleType:ERROR", - "-Xep:ExpectedExceptionChecker:ERROR", "-Xep:Finally:WARN", "-Xep:FloatingPointLiteralPrecision:ERROR", "-Xep:FragmentInjection:ERROR", From 54b1c7cc6a2ba6031b97d8a5c455d93ffd4ce5f5 Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Mon, 13 Jan 2020 15:45:55 +0100 Subject: [PATCH 11/22] Use ServiceLoader to define the default SSH session factory. Use ServiceLoader and define org.eclipse.jgit.transport.DefaultSshSessionFactory in META-INF/services/org.eclipse.jgit.transport.SshSessionFactory so that the legacy behavior is still the same. Bug: 553625 Change-Id: Id1a65506140d921ed76d83699e3817f0d2ca08ed Signed-off-by: Emmanuel Hugonnet Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.transport.SshSessionFactory | 1 + .../jgit/transport/DefaultSshSessionFactory.java | 4 +++- .../eclipse/jgit/transport/SshSessionFactory.java | 12 +++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 org.eclipse.jgit/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory diff --git a/org.eclipse.jgit/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory b/org.eclipse.jgit/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory new file mode 100644 index 000000000..1f8828457 --- /dev/null +++ b/org.eclipse.jgit/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory @@ -0,0 +1 @@ +org.eclipse.jgit.transport.DefaultSshSessionFactory diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java index 063fb6b8b..afa0a11c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java @@ -24,8 +24,10 @@ import com.jcraft.jsch.Session; *

* If user interactivity is required by SSH (e.g. to obtain a password), the * connection will immediately fail. + * + * @since 5.7 */ -class DefaultSshSessionFactory extends JschConfigSessionFactory { +public class DefaultSshSessionFactory extends JschConfigSessionFactory { /** {@inheritDoc} */ @Override protected void configure(OpenSshConfig.Host hc, Session session) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java index 906c4ed2d..ad04d424d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java @@ -13,6 +13,8 @@ package org.eclipse.jgit.transport; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Iterator; +import java.util.ServiceLoader; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Constants; @@ -31,8 +33,16 @@ import org.eclipse.jgit.util.SystemReader; * SshSessionFactory for the duration of the period they are using the Session. */ public abstract class SshSessionFactory { - private static SshSessionFactory INSTANCE = new DefaultSshSessionFactory(); + private static SshSessionFactory INSTANCE = loadSshSessionFactory(); + private static SshSessionFactory loadSshSessionFactory() { + ServiceLoader loader = ServiceLoader.load(SshSessionFactory.class); + Iterator iter = loader.iterator(); + if(iter.hasNext()) { + return iter.next(); + } + return null; + } /** * Get the currently configured JVM-wide factory. *

From 7a23fc1250765eb455d71ddd012fc9fbb1e64b65 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sun, 26 Jan 2020 20:26:01 +0100 Subject: [PATCH 12/22] Fix SshSessionFactory#setInstance to use service loader If setInstance(SshSessionFactory) is called with parameter null set default session factory using the newly introduced service loader instead of hard-coding the default factory class. Change-Id: I86b5932333cc53b706534a2822e0fd96e12e6e47 Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/transport/SshSessionFactory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java index ad04d424d..e6d204242 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java @@ -63,10 +63,11 @@ public abstract class SshSessionFactory { * default factory will be restored.s */ public static void setInstance(SshSessionFactory newFactory) { - if (newFactory != null) + if (newFactory != null) { INSTANCE = newFactory; - else - INSTANCE = new DefaultSshSessionFactory(); + } else { + INSTANCE = loadSshSessionFactory(); + } } /** From 0e4a717870f64e667e657650f12e93d477d369c3 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 27 Jan 2020 01:46:19 +0100 Subject: [PATCH 13/22] Update Orbit to I20200126235943 and org.junit to 4.13.0.v20200126-2018 Change-Id: I2eb4d34512d169aa7ec9b6437b49c6a43b4a8e38 Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.10.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.10.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.11.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.11.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.12.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.12.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.13.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.13.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.14-staging.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.14-staging.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.8.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.8.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.9.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.9.tpd | 2 +- .../orbit/{I20200120214610.tpd => I20200126235943.tpd} | 8 ++++---- 19 files changed, 49 insertions(+), 49 deletions(-) rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/{I20200120214610.tpd => I20200126235943.tpd} (95%) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 09f92c236..cf1dfaca1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd index 2a0a6060c..ef908e72f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd @@ -1,7 +1,7 @@ target "jgit-4.10" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/2018-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index d77379bd4..baf71f420 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd index 5ca669b51..b8683a52b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd @@ -1,7 +1,7 @@ target "jgit-4.11" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/2019-03/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index f9e471545..d34c4164e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd index 8f9736bc9..812e17235 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd @@ -1,7 +1,7 @@ target "jgit-4.12" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/2019-06/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index f9024fa1f..14df61ad1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd index e785aa0f9..323aabb87 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd @@ -1,7 +1,7 @@ target "jgit-4.13" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index 7d4f5918a..01460fedf 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd index c3b73764e..67ea4ea88 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd @@ -1,7 +1,7 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/staging/2019-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index a3e55b77c..13572d838 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index a90855bea..455dc96d5 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,7 +1,7 @@ target "jgit-4.6" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/neon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 355b37359..966f77f03 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index 8da14627c..e50501f82 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,7 +1,7 @@ target "jgit-4.7" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/oxygen/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index 15198f28b..e64ce3beb 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd index 65146f8fe..be46cf9db 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd @@ -1,7 +1,7 @@ target "jgit-4.8" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/photon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index c76ddede2..42138b179 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd index 63b2948c8..cc77ea3ee 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd @@ -1,7 +1,7 @@ target "jgit-4.9" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200120214610.tpd" +include "orbit/I20200126235943.tpd" location "http://download.eclipse.org/releases/2018-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd similarity index 95% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd index 33d72610a..5ca0a9360 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200120214610.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd @@ -1,7 +1,7 @@ -target "I20200120214610" with source configurePhase +target "I20200126235943" with source configurePhase // see http://download.eclipse.org/tools/orbit/downloads/ -location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200120214610/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200126235943/repository" { com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] @@ -49,8 +49,8 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/I202001202146 org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519] org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246] org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246] - org.junit [4.13.0.v20200120-1926,4.13.0.v20200120-1926] - org.junit.source [4.13.0.v20200120-1926,4.13.0.v20200120-1926] + org.junit [4.13.0.v20200126-2018,4.13.0.v20200126-2018] + org.junit.source [4.13.0.v20200126-2018,4.13.0.v20200126-2018] org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420] From 4cc13297ccf1fa3e982bbb5638162b3bad63f93c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 27 Jan 2020 09:47:05 +0900 Subject: [PATCH 14/22] ErrorProne: Enable and fix UnusedException check Enable UnusedException at ERROR level which causes the build to fail in many places with: [UnusedException] This catch block catches an symbol and re-throws another, but swallows the caught symbol rather than setting it as a cause. This can make debugging harder. Fix it by setting the caught exception as cause on the subsequently thrown exception. Note: The grammatically incorrect error message is copy-pasted as-is from the version of ErrorProne currently used in Bazel; it has been fixed by [1] in the latest version. [1] https://github.com/google/error-prone/commit/d57a39c Change-Id: I11ed38243091fc12f64f1b2db404ba3f1d2e98b5 Signed-off-by: David Pursehouse Signed-off-by: Matthias Sohn --- .../eclipse/jgit/http/server/GitFilter.java | 3 ++- .../eclipse/jgit/junit/TestRepository.java | 2 +- .../src/org/eclipse/jgit/lfs/LfsPointer.java | 2 -- .../jgit/lfs/lib/AbbreviatedLongObjectId.java | 7 +++++-- .../eclipse/jgit/lfs/lib/LongObjectId.java | 8 +++++--- .../jgit/lfs/lib/MutableLongObjectId.java | 8 +++++--- .../src/org/eclipse/jgit/pgm/Checkout.java | 2 +- .../src/org/eclipse/jgit/pgm/Clone.java | 2 +- .../src/org/eclipse/jgit/pgm/ReceivePack.java | 2 +- .../src/org/eclipse/jgit/pgm/Tag.java | 2 +- .../src/org/eclipse/jgit/pgm/UploadPack.java | 2 +- .../jgit/pgm/debug/RebuildCommitGraph.java | 8 ++++++-- .../eclipse/jgit/pgm/debug/ShowPackDelta.java | 2 +- .../pgm/opt/AbstractTreeIteratorHandler.java | 4 +++- .../jgit/pgm/opt/RevCommitHandler.java | 4 +++- .../eclipse/jgit/pgm/opt/RevTreeHandler.java | 4 +++- .../jgit/util/io/TimeoutOutputStreamTest.java | 8 ++++++-- .../org/eclipse/jgit/api/CloneCommand.java | 7 ++++--- .../org/eclipse/jgit/api/FetchCommand.java | 2 +- .../org/eclipse/jgit/api/LsRemoteCommand.java | 2 +- .../src/org/eclipse/jgit/api/PushCommand.java | 5 +++-- .../eclipse/jgit/diff/SimilarityIndex.java | 1 + .../eclipse/jgit/gitrepo/ManifestParser.java | 2 +- .../org/eclipse/jgit/gitrepo/RepoCommand.java | 2 +- .../jgit/internal/fsck/FsckPackParser.java | 7 +++++-- .../storage/dfs/DfsBlockCacheConfig.java | 2 +- .../storage/file/ObjectDirectory.java | 3 ++- .../jgit/internal/storage/file/PackFile.java | 2 +- .../internal/storage/file/RefDirectory.java | 5 ++++- .../internal/storage/file/UnpackedObject.java | 16 +++++++++++---- .../internal/storage/pack/PackWriter.java | 9 +++++---- .../submodule/SubmoduleValidator.java | 7 ++++--- .../eclipse/jgit/lib/AbbreviatedObjectId.java | 7 +++++-- .../src/org/eclipse/jgit/lib/Constants.java | 5 ++++- .../jgit/lib/DefaultTypedConfigGetter.java | 10 +++++++--- .../org/eclipse/jgit/lib/MutableObjectId.java | 6 ++++-- .../src/org/eclipse/jgit/lib/ObjectId.java | 6 ++++-- .../src/org/eclipse/jgit/lib/Repository.java | 20 ++++++++++++++----- .../org/eclipse/jgit/transport/AmazonS3.java | 3 ++- .../jgit/transport/BasePackConnection.java | 4 +++- .../eclipse/jgit/transport/PacketLineIn.java | 8 +++++++- .../eclipse/jgit/transport/ReceivePack.java | 2 +- .../eclipse/jgit/transport/TestProtocol.java | 2 +- .../jgit/transport/TransportBundleFile.java | 5 ++++- .../jgit/transport/TransportLocal.java | 5 ++++- .../org/eclipse/jgit/transport/URIish.java | 5 ++++- .../jgit/transport/WalkEncryption.java | 13 +++++++----- .../jgit/treewalk/WorkingTreeIterator.java | 2 +- .../src/org/eclipse/jgit/util/FileUtils.java | 3 ++- .../jgit/util/io/TimeoutInputStream.java | 15 ++++++++------ .../jgit/util/io/TimeoutOutputStream.java | 17 +++++++++------- tools/BUILD | 1 + 52 files changed, 187 insertions(+), 94 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java index 9b17132d0..1769832fb 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java @@ -298,7 +298,8 @@ public class GitFilter extends MetaFilter { try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { - throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n)); + throw new ServletException(MessageFormat.format( + HttpServerText.get().invalidBoolean, param, n), err); } } diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index d68c5c891..a5b3b1f3a 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -973,7 +973,7 @@ public class TestRepository implements AutoCloseable { try { lck.write(bin); } catch (IOException ioe) { - throw new ObjectWritingException("Can't write " + p); + throw new ObjectWritingException("Can't write " + p, ioe); } if (!lck.commit()) throw new ObjectWritingException("Can't write " + p); diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java index c4a51c7b9..55d2cfa6e 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java @@ -18,7 +18,6 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; -import java.nio.charset.UnsupportedCharsetException; import java.util.Locale; import org.eclipse.jgit.annotations.Nullable; @@ -110,7 +109,6 @@ public class LfsPointer implements Comparable { ps.print(size + "\n"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { // should not happen, we are using a standard charset - throw new UnsupportedCharsetException(UTF_8.name()); } } diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java index a2bcc35ee..9016e5394 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java @@ -121,8 +121,11 @@ public final class AbbreviatedLongObjectId implements Serializable { final long c = hexUInt64(bs, ptr + 32, end); final long d = hexUInt64(bs, ptr + 48, end); return new AbbreviatedLongObjectId(end - ptr, a, b, c, d); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidLongObjectIdException(bs, ptr, end - ptr); + } catch (ArrayIndexOutOfBoundsException e) { + InvalidLongObjectIdException e1 = new InvalidLongObjectIdException( + bs, ptr, end - ptr); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java index 000e9b206..15b3ca4c6 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java @@ -223,9 +223,11 @@ public class LongObjectId extends AnyLongObjectId implements Serializable { final long c = RawParseUtils.parseHexInt64(bs, p + 32); final long d = RawParseUtils.parseHexInt64(bs, p + 48); return new LongObjectId(a, b, c, d); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidLongObjectIdException(bs, p, - Constants.LONG_OBJECT_ID_STRING_LENGTH); + } catch (ArrayIndexOutOfBoundsException e) { + InvalidLongObjectIdException e1 = new InvalidLongObjectIdException( + bs, p, Constants.LONG_OBJECT_ID_STRING_LENGTH); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java index 368f6af7e..012e4ae91 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java @@ -213,9 +213,11 @@ public class MutableLongObjectId extends AnyLongObjectId { w2 = RawParseUtils.parseHexInt64(bs, p + 16); w3 = RawParseUtils.parseHexInt64(bs, p + 32); w4 = RawParseUtils.parseHexInt64(bs, p + 48); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidLongObjectIdException(bs, p, - Constants.LONG_OBJECT_ID_STRING_LENGTH); + } catch (ArrayIndexOutOfBoundsException e) { + InvalidLongObjectIdException e1 = new InvalidLongObjectIdException( + bs, p, Constants.LONG_OBJECT_ID_STRING_LENGTH); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index 455abcd37..98724bfce 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -100,7 +100,7 @@ class Checkout extends TextBuiltin { .format(CLIText.get().pathspecDidNotMatch, name), e); } catch (RefAlreadyExistsException e) { throw die(MessageFormat - .format(CLIText.get().branchAlreadyExists, name)); + .format(CLIText.get().branchAlreadyExists, name), e); } catch (CheckoutConflictException e) { StringBuilder builder = new StringBuilder(); builder.append(CLIText.get().checkoutConflict); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index 243e99fdf..8f80d6d70 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -110,7 +110,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, - sourceUri)); + sourceUri), e); } finally { if (db != null) db.close(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java index cbb5d846b..f570f7f99 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java @@ -42,7 +42,7 @@ class ReceivePack extends TextBuiltin { db = key.open(true /* must exist */); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, - dstGitdir.getPath())); + dstGitdir.getPath()), notFound); } catch (IOException e) { throw die(e.getMessage(), e); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index 8c3988603..b408b78f3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -74,7 +74,7 @@ class Tag extends TextBuiltin { command.call(); } catch (RefAlreadyExistsException e) { throw die(MessageFormat.format( - CLIText.get().tagAlreadyExists, tagName)); + CLIText.get().tagAlreadyExists, tagName), e); } } } else { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java index 69c8eb570..36103f2e6 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java @@ -50,7 +50,7 @@ class UploadPack extends TextBuiltin { up.upload(ins, outs, errs); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, - srcGitdir.getPath())); + srcGitdir.getPath()), notFound); } catch (IOException e) { throw die(e.getMessage(), e); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index ddd48da46..8d884c12d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -235,7 +235,9 @@ class RebuildCommitGraph extends TextBuiltin { try { lck.write(content); } catch (IOException ioe) { - throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file)); + throw new ObjectWritingException( + MessageFormat.format(CLIText.get().cantWrite, file), + ioe); } if (!lck.commit()) throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file)); @@ -266,7 +268,9 @@ class RebuildCommitGraph extends TextBuiltin { errw.println(MessageFormat.format(CLIText.get().skippingObject, type, name)); continue; } - throw new MissingObjectException(id, type); + MissingObjectException mue1 = new MissingObjectException(id, type); + mue1.initCause(mue); + throw mue1; } refs.put(name, new ObjectIdRef.Unpeeled(Ref.Storage.PACKED, name, id)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java index 6f0aba377..49f7ada45 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java @@ -57,7 +57,7 @@ class ShowPackDelta extends TextBuiltin { if (BinaryDelta.getResultSize(delta) != size) throw die("Object " + obj.name() + " is not a delta"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (ArrayIndexOutOfBoundsException bad) { - throw die("Object " + obj.name() + " is not a delta"); //$NON-NLS-1$ //$NON-NLS-2$ + throw die("Object " + obj.name() + " is not a delta", bad); //$NON-NLS-1$ //$NON-NLS-2$ } outw.println(BinaryDelta.format(delta)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java index 07a1bb801..d8604726a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java @@ -101,8 +101,10 @@ public class AbstractTreeIteratorHandler extends try (ObjectReader curs = clp.getRepository().newObjectReader()) { p.reset(curs, clp.getRevWalk().parseTree(id)); } catch (MissingObjectException | IncorrectObjectTypeException e) { - throw new CmdLineException(clp, + CmdLineException cle = new CmdLineException(clp, CLIText.format(CLIText.get().notATree), name); + cle.initCause(e); + throw cle; } catch (IOException e) { throw new CmdLineException(clp, CLIText.format(CLIText.get().cannotReadBecause), name, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java index f521775c7..8b2bed36a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java @@ -98,8 +98,10 @@ public class RevCommitHandler extends OptionHandler { try { c = clp.getRevWalk().parseCommit(id); } catch (MissingObjectException | IncorrectObjectTypeException e) { - throw new CmdLineException(clp, + CmdLineException cle = new CmdLineException(clp, CLIText.format(CLIText.get().notACommit), name); + cle.initCause(e); + throw cle; } catch (IOException e) { throw new CmdLineException(clp, CLIText.format(CLIText.get().cannotReadBecause), name, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java index fa9636168..357886d0f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java @@ -70,8 +70,10 @@ public class RevTreeHandler extends OptionHandler { try { c = clp.getRevWalk().parseTree(id); } catch (MissingObjectException | IncorrectObjectTypeException e) { - throw new CmdLineException(clp, + CmdLineException cle = new CmdLineException(clp, CLIText.format(CLIText.get().notATree), name); + cle.initCause(e); + throw cle; } catch (IOException e) { throw new CmdLineException(clp, CLIText.format(CLIText.get().cannotReadBecause), name, diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java index 024f0f3b0..567880f47 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java @@ -149,7 +149,9 @@ public class TimeoutOutputStreamTest { try { Thread.sleep(1000); } catch (InterruptedException e) { - throw new InterruptedIOException(); + InterruptedIOException e1 = new InterruptedIOException(); + e1.initCause(e); + throw e1; } } } @@ -202,7 +204,9 @@ public class TimeoutOutputStreamTest { try { Thread.sleep(1000); } catch (InterruptedException e) { - throw new InterruptedIOException(); + InterruptedIOException e1 = new InterruptedIOException(); + e1.initCause(e); + throw e1; } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index 5232223c4..eef794001 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -160,7 +160,7 @@ public class CloneCommand extends TransportCommand { verifyDirectories(u); } catch (URISyntaxException e) { throw new InvalidRemoteException( - MessageFormat.format(JGitText.get().invalidURL, uri)); + MessageFormat.format(JGitText.get().invalidURL, uri), e); } @SuppressWarnings("resource") // Closed by caller Repository repository = init(); @@ -180,8 +180,9 @@ public class CloneCommand extends TransportCommand { repository.close(); } cleanup(); - throw new InvalidRemoteException(MessageFormat.format( - JGitText.get().invalidRemote, remote)); + throw new InvalidRemoteException( + MessageFormat.format(JGitText.get().invalidRemote, remote), + e); } catch (GitAPIException | RuntimeException e) { if (repository != null) { repository.close(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java index a4b9bcf00..033dd60c3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java @@ -223,7 +223,7 @@ public class FetchCommand extends TransportCommand { e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( - JGitText.get().invalidRemote, remote)); + JGitText.get().invalidRemote, remote), e); } catch (NotSupportedException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfFetchCommand, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java index 12517df51..a4ca30909 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java @@ -180,7 +180,7 @@ public class LsRemoteCommand extends } } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( - JGitText.get().invalidRemote, remote)); + JGitText.get().invalidRemote, remote), e); } catch (NotSupportedException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java index b9b15ebdc..aa5a63499 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java @@ -152,8 +152,9 @@ public class PushCommand extends } } catch (URISyntaxException e) { - throw new InvalidRemoteException(MessageFormat.format( - JGitText.get().invalidRemote, remote)); + throw new InvalidRemoteException( + MessageFormat.format(JGitText.get().invalidRemote, remote), + e); } catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java index fcfae65bc..fb6e5df58 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java @@ -350,6 +350,7 @@ public class SimilarityIndex { return (1 << idHashBits) * (idHashBits - 3) / idHashBits; } + @SuppressWarnings("UnusedException") private void grow() throws TableFullException { if (idHashBits == 30) throw new TableFullException(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java index 023efd8e1..6a2c3898a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java @@ -139,7 +139,7 @@ public class ManifestParser extends DefaultHandler { try { xr = XMLReaderFactory.createXMLReader(); } catch (SAXException e) { - throw new IOException(JGitText.get().noXMLParserAvailable); + throw new IOException(JGitText.get().noXMLParserAvailable, e); } xr.setContentHandler(this); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index 98f61d159..c039aaffa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -541,7 +541,7 @@ public class RepoCommand extends GitCommand { inputStream = new FileInputStream(manifestPath); } catch (IOException e) { throw new IllegalArgumentException( - JGitText.get().pathNotConfigured); + JGitText.get().pathNotConfigured, e); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java index ad7aebc27..3b9498456 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java @@ -290,9 +290,12 @@ public class FsckPackParser extends PackParser { ErrorType.MISMATCH_CRC); } } catch (MissingObjectException e) { - throw new CorruptPackIndexException(MessageFormat - .format(JGitText.get().missingCRC, entry.getName()), + CorruptPackIndexException cpe = new CorruptPackIndexException( + MessageFormat.format(JGitText.get().missingCRC, + entry.getName()), ErrorType.MISSING_CRC); + cpe.initCause(e); + throw cpe; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java index bee2e01a8..6e7ad3e61 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java @@ -236,7 +236,7 @@ public class DfsBlockCacheConfig { JGitText.get().enumValueNotSupported3, CONFIG_CORE_SECTION, CONFIG_DFS_SECTION, - CONFIG_KEY_STREAM_RATIO, v)); + CONFIG_KEY_STREAM_RATIO, v), e); } } return this; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java index 857c1730f..169587081 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java @@ -769,7 +769,8 @@ public class ObjectDirectory extends FileObjectDatabase { shallowCommitsIds.add(ObjectId.fromString(line)); } catch (IllegalArgumentException ex) { throw new IOException(MessageFormat - .format(JGitText.get().badShallowLine, line)); + .format(JGitText.get().badShallowLine, line), + ex); } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java index 0de818a1d..984c16366 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java @@ -1071,7 +1071,7 @@ public class PackFile implements Iterable { } catch (DataFormatException e) { throw new CorruptObjectException(MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos), - getPackFile())); + getPackFile()), e); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index b636db6f2..fddd430bf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -1035,7 +1035,10 @@ public class RefDirectory extends RefDatabase { lck.waitForStatChange(); } catch (InterruptedException e) { lck.unlock(); - throw new ObjectWritingException(MessageFormat.format(JGitText.get().interruptedWriting, name)); + throw new ObjectWritingException( + MessageFormat.format( + JGitText.get().interruptedWriting, name), + e); } if (!lck.commit()) throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToWrite, name)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java index 743badbcc..bf47d2c3c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java @@ -149,8 +149,10 @@ public class UnpackedObject { } return new LargeObject(type, size, path, id, wc.db); } catch (ZipException badStream) { - throw new CorruptObjectException(id, + CorruptObjectException coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); + coe.initCause(badStream); + throw coe; } } @@ -192,8 +194,10 @@ public class UnpackedObject { } return size; } catch (ZipException badStream) { - throw new CorruptObjectException(id, + CorruptObjectException coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); + coe.initCause(badStream); + throw coe; } } @@ -205,8 +209,10 @@ public class UnpackedObject { try { r = inf.inflate(buf); } catch (DataFormatException e) { - throw new CorruptObjectException(id, + CorruptObjectException coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); + coe.initCause(e); + throw coe; } if (r != 0) throw new CorruptObjectException(id, @@ -277,8 +283,10 @@ public class UnpackedObject { remaining -= r; return r; } catch (ZipException badStream) { - throw new CorruptObjectException(id, + CorruptObjectException coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); + coe.initCause(badStream); + throw coe; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 33ffe0717..9a6ec760b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -1579,8 +1579,8 @@ public class PackWriter implements AutoCloseable { if (pool.awaitTermination(60, TimeUnit.SECONDS)) break; } catch (InterruptedException e) { - throw new IOException( - JGitText.get().packingCancelledDuringObjectsWriting); + throw new IOException(JGitText + .get().packingCancelledDuringObjectsWriting, e); } } } @@ -1604,7 +1604,8 @@ public class PackWriter implements AutoCloseable { // Cross our fingers and just break out anyway. // throw new IOException( - JGitText.get().packingCancelledDuringObjectsWriting); + JGitText.get().packingCancelledDuringObjectsWriting, + ie); } } @@ -1645,7 +1646,7 @@ public class PackWriter implements AutoCloseable { for (Future f : futures) f.cancel(true); throw new IOException( - JGitText.get().packingCancelledDuringObjectsWriting); + JGitText.get().packingCancelledDuringObjectsWriting, ie); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java index 20066bec7..d0e24413b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java @@ -165,9 +165,10 @@ public class SubmoduleValidator { } } } catch (ConfigInvalidException e) { - throw new SubmoduleValidationException( - JGitText.get().invalidGitModules, - GITMODULES_PARSE); + SubmoduleValidationException sve = new SubmoduleValidationException( + JGitText.get().invalidGitModules, GITMODULES_PARSE); + sve.initCause(e); + throw sve; } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java index a5e4d787f..dc5e5cc20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java @@ -114,8 +114,11 @@ public final class AbbreviatedObjectId implements Serializable { final int d = hexUInt32(bs, ptr + 24, end); final int e = hexUInt32(bs, ptr + 32, end); return new AbbreviatedObjectId(end - ptr, a, b, c, d, e); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidObjectIdException(bs, ptr, end - ptr); + } catch (ArrayIndexOutOfBoundsException e) { + InvalidObjectIdException e1 = new InvalidObjectIdException(bs, ptr, + end - ptr); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index d502274c4..ffc742d47 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -601,7 +601,10 @@ public final class Constants { throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType); } } catch (ArrayIndexOutOfBoundsException bad) { - throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType); + CorruptObjectException coe = new CorruptObjectException(id, + JGitText.get().corruptObjectInvalidType); + coe.initCause(bad); + throw coe; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java index abc9b2119..cc0b995f1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java @@ -46,7 +46,7 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().invalidBooleanValue, section, name, n)); + JGitText.get().invalidBooleanValue, section, name, n), err); } } @@ -152,7 +152,8 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter { return mul * Long.parseLong(n); } catch (NumberFormatException nfe) { throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().invalidIntegerValue, section, name, str)); + JGitText.get().invalidIntegerValue, section, name, str), + nfe); } } @@ -239,7 +240,10 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter { return wantUnit.convert(Long.parseLong(digits) * inputMul, inputUnit); } catch (NumberFormatException nfe) { - throw notTimeUnit(section, subsection, unitName, valueString); + IllegalArgumentException iae = notTimeUnit(section, subsection, + unitName, valueString); + iae.initCause(nfe); + throw iae; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java index 86b306d5b..4a712ba36 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java @@ -234,9 +234,11 @@ public class MutableObjectId extends AnyObjectId { w3 = RawParseUtils.parseHexInt32(bs, p + 16); w4 = RawParseUtils.parseHexInt32(bs, p + 24); w5 = RawParseUtils.parseHexInt32(bs, p + 32); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidObjectIdException(bs, p, + } catch (ArrayIndexOutOfBoundsException e) { + InvalidObjectIdException e1 = new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java index 11c0aefe3..269049f4a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java @@ -213,9 +213,11 @@ public class ObjectId extends AnyObjectId implements Serializable { final int d = RawParseUtils.parseHexInt32(bs, p + 24); final int e = RawParseUtils.parseHexInt32(bs, p + 32); return new ObjectId(a, b, c, d, e); - } catch (ArrayIndexOutOfBoundsException e1) { - throw new InvalidObjectIdException(bs, p, + } catch (ArrayIndexOutOfBoundsException e) { + InvalidObjectIdException e1 = new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); + e1.initCause(e); + throw e1; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 503e218b5..a7a832c1a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -550,9 +550,11 @@ public abstract class Repository implements AutoCloseable { try { pnum = Integer.parseInt(parentnum); } catch (NumberFormatException e) { - throw new RevisionSyntaxException( + RevisionSyntaxException rse = new RevisionSyntaxException( JGitText.get().invalidCommitParentNumber, revstr); + rse.initCause(e); + throw rse; } if (pnum != 0) { RevCommit commit = (RevCommit) rev; @@ -647,8 +649,10 @@ public abstract class Repository implements AutoCloseable { try { dist = Integer.parseInt(distnum); } catch (NumberFormatException e) { - throw new RevisionSyntaxException( + RevisionSyntaxException rse = new RevisionSyntaxException( JGitText.get().invalidAncestryLength, revstr); + rse.initCause(e); + throw rse; } } else dist = 1; @@ -707,7 +711,10 @@ public abstract class Repository implements AutoCloseable { remoteConfig = new RemoteConfig(getConfig(), "origin"); //$NON-NLS-1$ } catch (URISyntaxException e) { - throw new RevisionSyntaxException(revstr); + RevisionSyntaxException rse = new RevisionSyntaxException( + revstr); + rse.initCause(e); + throw rse; } String remoteBranchName = getConfig() .getString( @@ -874,8 +881,11 @@ public abstract class Repository implements AutoCloseable { try { number = Integer.parseInt(time); } catch (NumberFormatException nfe) { - throw new RevisionSyntaxException(MessageFormat.format( - JGitText.get().invalidReflogRevision, time)); + RevisionSyntaxException rse = new RevisionSyntaxException( + MessageFormat.format(JGitText.get().invalidReflogRevision, + time)); + rse.initCause(nfe); + throw rse; } assert number >= 0; ReflogReader reader = getReflogReader(ref.getName()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index a177c290e..1e7f3b1f0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -655,7 +655,8 @@ public class AmazonS3 { try { xr = XMLReaderFactory.createXMLReader(); } catch (SAXException e) { - throw new IOException(JGitText.get().noXMLParserAvailable); + throw new IOException( + JGitText.get().noXMLParserAvailable, e); } xr.setContentHandler(this); try (InputStream in = c.getInputStream()) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index 8604244db..1417faee8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -203,7 +203,9 @@ abstract class BasePackConnection extends BaseConnection { try { id = ObjectId.fromString(line.substring(0, 40)); } catch (InvalidObjectIdException e) { - throw invalidRefAdvertisementLine(line); + PackProtocolException ppe = invalidRefAdvertisementLine(line); + ppe.initCause(e); + throw ppe; } if (name.equals(".have")) { //$NON-NLS-1$ additionalHaves.add(id); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java index 93800d500..c992bb1cb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -286,7 +286,7 @@ public class PacketLineIn { try { len = RawParseUtils.parseHexInt16(lineBuffer, 0); } catch (ArrayIndexOutOfBoundsException err) { - throw invalidHeader(); + throw invalidHeader(err); } if (len == 0) { @@ -320,6 +320,12 @@ public class PacketLineIn { + (char) lineBuffer[2] + (char) lineBuffer[3])); } + private IOException invalidHeader(Throwable cause) { + IOException ioe = invalidHeader(); + ioe.initCause(cause); + return ioe; + } + /** * IOException thrown by read when the configured input limit is exceeded. * diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 24cd8f3df..e505e1706 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -2110,7 +2110,7 @@ public class ReceivePack { } catch (InputOverLimitIOException e) { String msg = JGitText.get().tooManyCommands; fatalError(msg); - throw new PackProtocolException(msg); + throw new PackProtocolException(msg, e); } finally { try { close(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java index 13b891fcf..c6ecb3a79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java @@ -140,7 +140,7 @@ public class TestProtocol extends TransportProtocol { int n = handles.size(); uri = new URIish(SCHEME + "://test/conn" + n); //$NON-NLS-1$ } catch (URISyntaxException e) { - throw new IllegalStateException(); + throw new IllegalStateException(e); } handles.put(uri, new Handle(req, remote)); return uri; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java index 155c115f8..04ebddb10 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java @@ -113,7 +113,10 @@ class TransportBundleFile extends Transport implements TransportBundle { try { src = new FileInputStream(bundle); } catch (FileNotFoundException err) { - throw new TransportException(uri, JGitText.get().notFound); + TransportException te = new TransportException(uri, + JGitText.get().notFound); + te.initCause(err); + throw te; } return new BundleFetchConnection(this, src); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java index be17b44d7..403f98d86 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java @@ -143,7 +143,10 @@ class TransportLocal extends Transport implements PackTransport { .setFS(local != null ? local.getFS() : FS.DETECTED) .setGitDir(remoteGitDir).build(); } catch (IOException err) { - throw new TransportException(uri, JGitText.get().notAGitDirectory); + TransportException te = new TransportException(uri, + JGitText.get().notAGitDirectory); + te.initCause(err); + throw te; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java index 6ebb668c7..858d1f7b6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -266,7 +266,10 @@ public class URIish implements Serializable { try { val = parseHexByte(c1, c2); } catch (ArrayIndexOutOfBoundsException e) { - throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish); + URISyntaxException use = new URISyntaxException(s, + JGitText.get().cannotParseGitURIish); + use.initCause(e); + throw use; } os[j++] = (byte) val; i += 2; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java index 1880c8b73..df9f11ecf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java @@ -282,9 +282,12 @@ abstract class WalkEncryption { String REGEX_TRANS = "(.+)/(.+)/(.+)"; //$NON-NLS-1$ } - static GeneralSecurityException securityError(String message) { - return new GeneralSecurityException( + static GeneralSecurityException securityError(String message, + Throwable cause) { + GeneralSecurityException e = new GeneralSecurityException( MessageFormat.format(JGitText.get().encryptionError, message)); + e.initCause(cause); + return e; } /** @@ -332,21 +335,21 @@ abstract class WalkEncryption { try { size = Integer.parseInt(keySize); } catch (Exception e) { - throw securityError(X_KEY_SIZE + EMPTY + keySize); + throw securityError(X_KEY_SIZE + EMPTY + keySize, e); } final int iter; try { iter = Integer.parseInt(keyIter); } catch (Exception e) { - throw securityError(X_KEY_ITER + EMPTY + keyIter); + throw securityError(X_KEY_ITER + EMPTY + keyIter, e); } final byte[] salt; try { salt = Hex.decode(keySalt.replaceAll(REGEX_WS, EMPTY)); } catch (Exception e) { - throw securityError(X_KEY_SALT + EMPTY + keySalt); + throw securityError(X_KEY_SALT + EMPTY + keySalt, e); } KeySpec keySpec = new PBEKeySpec(pass.toCharArray(), salt, iter, size); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 02ca86b95..2c3f3e254 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -1159,7 +1159,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { } catch (CharacterCodingException e) { // This should so never happen. throw new RuntimeException(MessageFormat.format( - JGitText.get().unencodeableFile, getName())); + JGitText.get().unencodeableFile, getName()), e); } encodedNameLen = b.limit(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java index fa99087fe..4831fbb64 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java @@ -300,7 +300,8 @@ public class FileUtils { } catch (InterruptedException e) { throw new IOException( MessageFormat.format(JGitText.get().renameFileFailed, - src.getAbsolutePath(), dst.getAbsolutePath())); + src.getAbsolutePath(), dst.getAbsolutePath()), + e); } } throw new IOException( diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java index 135613600..1947b3bf0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java @@ -70,7 +70,7 @@ public class TimeoutInputStream extends FilterInputStream { beginRead(); return super.read(); } catch (InterruptedIOException e) { - throw readTimedOut(); + throw readTimedOut(e); } finally { endRead(); } @@ -89,7 +89,7 @@ public class TimeoutInputStream extends FilterInputStream { beginRead(); return super.read(buf, off, cnt); } catch (InterruptedIOException e) { - throw readTimedOut(); + throw readTimedOut(e); } finally { endRead(); } @@ -102,7 +102,7 @@ public class TimeoutInputStream extends FilterInputStream { beginRead(); return super.skip(cnt); } catch (InterruptedIOException e) { - throw readTimedOut(); + throw readTimedOut(e); } finally { endRead(); } @@ -116,8 +116,11 @@ public class TimeoutInputStream extends FilterInputStream { myTimer.end(); } - private InterruptedIOException readTimedOut() { - return new InterruptedIOException(MessageFormat.format( - JGitText.get().readTimedOut, Integer.valueOf(timeout))); + private InterruptedIOException readTimedOut(InterruptedIOException e) { + InterruptedIOException interrupted = new InterruptedIOException( + MessageFormat.format(JGitText.get().readTimedOut, + Integer.valueOf(timeout))); + interrupted.initCause(e); + return interrupted; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java index 7532c42b9..3fbf6ffdc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java @@ -72,7 +72,7 @@ public class TimeoutOutputStream extends OutputStream { beginWrite(); dst.write(b); } catch (InterruptedIOException e) { - throw writeTimedOut(); + throw writeTimedOut(e); } finally { endWrite(); } @@ -91,7 +91,7 @@ public class TimeoutOutputStream extends OutputStream { beginWrite(); dst.write(buf, off, len); } catch (InterruptedIOException e) { - throw writeTimedOut(); + throw writeTimedOut(e); } finally { endWrite(); } @@ -104,7 +104,7 @@ public class TimeoutOutputStream extends OutputStream { beginWrite(); dst.flush(); } catch (InterruptedIOException e) { - throw writeTimedOut(); + throw writeTimedOut(e); } finally { endWrite(); } @@ -117,7 +117,7 @@ public class TimeoutOutputStream extends OutputStream { beginWrite(); dst.close(); } catch (InterruptedIOException e) { - throw writeTimedOut(); + throw writeTimedOut(e); } finally { endWrite(); } @@ -131,8 +131,11 @@ public class TimeoutOutputStream extends OutputStream { myTimer.end(); } - private InterruptedIOException writeTimedOut() { - return new InterruptedIOException(MessageFormat.format( - JGitText.get().writeTimedOut, Integer.valueOf(timeout))); + private InterruptedIOException writeTimedOut(InterruptedIOException cause) { + InterruptedIOException e = new InterruptedIOException( + MessageFormat.format(JGitText.get().writeTimedOut, + Integer.valueOf(timeout))); + e.initCause(cause); + return e; } } diff --git a/tools/BUILD b/tools/BUILD index d66837700..2b208744b 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -78,6 +78,7 @@ java_package_configuration( "-Xep:TypeParameterShadowing:ERROR", "-Xep:TypeParameterUnusedInFormals:WARN", "-Xep:URLEqualsHashCode:ERROR", + "-Xep:UnusedException:ERROR", "-Xep:UnsynchronizedOverridesSynchronized:ERROR", "-Xep:WaitNotInLoop:ERROR", ], From 64715a189fe19e8a25bb8757591e3ef60f3f9aa8 Mon Sep 17 00:00:00 2001 From: Alex Jitianu Date: Tue, 3 Dec 2019 09:21:13 +0000 Subject: [PATCH 15/22] FS: Don't use innocuous threads for CompletableFuture The default threads from the ForkJoinPool run without any privileges when a SecurityManager is installed, leading to SecurityExceptions when trying to create the probe file even if the application otherwise has write privileges in the directory. Use a dedicated ThreadPoolExecutor using daemon threads instead. Bug: 551690 Change-Id: Id5376f09f0d7da5ceea367e1f0dfc70f823d62d3 Signed-off-by: Alex Jitianu Signed-off-by: Thomas Wolf --- ...SecurityManagerMissingPermissionsTest.java | 132 ++++++++++++++++++ .../src/org/eclipse/jgit/util/FS.java | 41 +++++- 2 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java new file mode 100644 index 000000000..a07f37009 --- /dev/null +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2019 Alex Jitianu and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0 which is available at + * https://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package org.eclipse.jgit.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.Policy; +import java.util.Collections; + +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.WriterAppender; +import org.eclipse.jgit.junit.RepositoryTestCase; +import org.eclipse.jgit.util.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that using a SecurityManager does not result in errors logged. + */ +public class SecurityManagerMissingPermissionsTest extends RepositoryTestCase { + + /** + * Collects all logging sent to the logging system. + */ + private final StringWriter errorOutputWriter = new StringWriter(); + + /** + * Appender to intercept all logging sent to the logging system. + */ + private WriterAppender appender; + + private SecurityManager originalSecurityManager; + + @Override + @Before + public void setUp() throws Exception { + originalSecurityManager = System.getSecurityManager(); + + appender = new WriterAppender( + new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN), + errorOutputWriter); + + Logger.getRootLogger().addAppender(appender); + + refreshPolicyAllPermission(Policy.getPolicy()); + System.setSecurityManager(new SecurityManager()); + super.setUp(); + } + + /** + * If a SecurityManager is active a lot of {@link java.io.FilePermission} + * errors are thrown and logged while initializing a repository. + * + * @throws Exception + */ + @Test + public void testCreateNewRepos_MissingPermissions() throws Exception { + File wcTree = new File(getTemporaryDirectory(), + "CreateNewRepositoryTest_testCreateNewRepos"); + + File marker = new File(getTemporaryDirectory(), "marker"); + Files.write(marker.toPath(), Collections.singletonList("Can write")); + assertTrue("Can write in test directory", marker.isFile()); + FileUtils.delete(marker); + assertFalse("Can delete in test direcory", marker.exists()); + + Git git = Git.init().setBare(false) + .setDirectory(new File(wcTree.getAbsolutePath())).call(); + + addRepoToClose(git.getRepository()); + + assertEquals("", errorOutputWriter.toString()); + } + + @Override + @After + public void tearDown() throws Exception { + System.setSecurityManager(originalSecurityManager); + Logger.getRootLogger().removeAppender(appender); + super.tearDown(); + } + + /** + * Refresh the Java Security Policy. + * + * @param policy + * the policy object + * + * @throws IOException + * if the temporary file that contains the policy could not be + * created + */ + private static void refreshPolicyAllPermission(Policy policy) + throws IOException { + // Starting with an all permissions policy. + String policyString = "grant { permission java.security.AllPermission; };"; + + // Do not use TemporaryFilesFactory, it will create a dependency cycle + Path policyFile = Files.createTempFile("testpolicy", ".txt"); + + try { + Files.write(policyFile, Collections.singletonList(policyString)); + System.setProperty("java.security.policy", + policyFile.toUri().toURL().toString()); + policy.refresh(); + } finally { + try { + Files.delete(policyFile); + } catch (IOException e) { + // Do not log; the test tests for no logging having occurred + e.printStackTrace(); + } + } + } + +} diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index cd6647c62..91734a0c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, Shawn O. Pearce and others + * Copyright (C) 2008, 2020 Shawn O. Pearce and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0 which is available at @@ -49,11 +49,15 @@ import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -221,6 +225,31 @@ public abstract class FS { private static final Duration FALLBACK_MIN_RACY_INTERVAL = Duration .ofMillis(10); + private static final AtomicInteger threadNumber = new AtomicInteger(1); + + /** + * Don't use the default thread factory of the ForkJoinPool for the + * CompletableFuture; it runs without any privileges, which causes + * trouble if a SecurityManager is present. + *

+ * Instead use normal daemon threads. They'll belong to the + * SecurityManager's thread group, or use the one of the calling thread, + * as appropriate. + *

+ * + * @see java.util.concurrent.Executors#newCachedThreadPool() + */ + private static final Executor FUTURE_RUNNER = new ThreadPoolExecutor(0, + 5, 30L, TimeUnit.SECONDS, new SynchronousQueue(), + runnable -> { + Thread t = new Thread(runnable, "FileStoreAttributeReader-" //$NON-NLS-1$ + + threadNumber.getAndIncrement()); + // Make sure these threads don't prevent application/JVM + // shutdown. + t.setDaemon(true); + return t; + }); + /** * Configures size and purge factor of the path-based cache for file * system attributes. Caching of file system attributes avoids recurring @@ -304,8 +333,7 @@ public abstract class FS { // Some earlier future might have set the value // and removed itself since we checked for the // value above. Hence check cache again. - FileStoreAttributes c = attributeCache - .get(s); + FileStoreAttributes c = attributeCache.get(s); if (c != null) { return Optional.of(c); } @@ -339,7 +367,7 @@ public abstract class FS { locks.remove(s); } return attributes; - }); + }, FUTURE_RUNNER); f = f.exceptionally(e -> { LOG.error(e.getLocalizedMessage(), e); return Optional.empty(); @@ -450,6 +478,11 @@ public abstract class FS { LOG.debug("{}: end measure timestamp resolution {} in {}", //$NON-NLS-1$ Thread.currentThread(), s, dir); return Optional.of(fsResolution); + } catch (SecurityException e) { + // Log it here; most likely deleteProbe() below will also run + // into a SecurityException, and then this one will be lost + // without trace. + LOG.warn(e.getLocalizedMessage(), e); } catch (AccessDeniedException e) { LOG.warn(e.getLocalizedMessage(), e); // see bug 548648 } catch (IOException e) { From af05850485c6075697bbe0438b257e462bf73169 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Mon, 27 Jan 2020 17:01:27 +0100 Subject: [PATCH 16/22] FS: re-order fields and use all uppercase for true constants Change-Id: I49fb77d6a12ae9083b5bf5779dc74a3dc49d7594 Signed-off-by: Thomas Wolf --- .../src/org/eclipse/jgit/util/FS.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 91734a0c2..415631805 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -204,20 +204,7 @@ public abstract class FS { public static final FileStoreAttributes FALLBACK_FILESTORE_ATTRIBUTES = new FileStoreAttributes( FALLBACK_TIMESTAMP_RESOLUTION); - private static final Map attributeCache = new ConcurrentHashMap<>(); - - private static final SimpleLruCache attrCacheByPath = new SimpleLruCache<>( - 100, 0.2f); - - private static AtomicBoolean background = new AtomicBoolean(); - - private static Map locks = new ConcurrentHashMap<>(); - - private static void setBackground(boolean async) { - background.set(async); - } - - private static final String javaVersionPrefix = SystemReader + private static final String JAVA_VERSION_PREFIX = SystemReader .getInstance().getHostname() + '|' + System.getProperty("java.vendor") + '|' //$NON-NLS-1$ + System.getProperty("java.version") + '|'; //$NON-NLS-1$ @@ -225,6 +212,15 @@ public abstract class FS { private static final Duration FALLBACK_MIN_RACY_INTERVAL = Duration .ofMillis(10); + private static final Map attributeCache = new ConcurrentHashMap<>(); + + private static final SimpleLruCache attrCacheByPath = new SimpleLruCache<>( + 100, 0.2f); + + private static final AtomicBoolean background = new AtomicBoolean(); + + private static final Map locks = new ConcurrentHashMap<>(); + private static final AtomicInteger threadNumber = new AtomicInteger(1); /** @@ -250,6 +246,10 @@ public abstract class FS { return t; }); + private static void setBackground(boolean async) { + background.set(async); + } + /** * Configures size and purge factor of the path-based cache for file * system attributes. Caching of file system attributes avoids recurring @@ -628,7 +628,7 @@ public abstract class FS { } else { storeKey = s.name(); } - return javaVersionPrefix + storeKey; + return JAVA_VERSION_PREFIX + storeKey; } private static TimeUnit getUnit(long nanos) { From 0babfaad8c6c695a24b9593273ba3e5ae8c2285b Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 29 Jan 2020 10:19:25 +0100 Subject: [PATCH 17/22] Update orbit to S20200128200239 for 2020-03 M2 - update org.junit to 4.13.0.v20200128-1312 Change-Id: Iaf4010f1d33635e5c69688874669d540e056b287 Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.10.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.10.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.11.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.11.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.12.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.12.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.13.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.13.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.14-staging.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.14-staging.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.8.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.8.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.9.target | 8 ++++---- .../org.eclipse.jgit.target/jgit-4.9.tpd | 2 +- .../orbit/{I20200126235943.tpd => staging-2020-03.tpd} | 8 ++++---- 19 files changed, 49 insertions(+), 49 deletions(-) rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/{I20200126235943.tpd => staging-2020-03.tpd} (95%) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index cf1dfaca1..f49adf9a6 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd index ef908e72f..fc18203cb 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd @@ -1,7 +1,7 @@ target "jgit-4.10" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/2018-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index baf71f420..e68ab631f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd index b8683a52b..dd1f6245b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd @@ -1,7 +1,7 @@ target "jgit-4.11" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/2019-03/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index d34c4164e..e83924c3f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd index 812e17235..bf32ed904 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd @@ -1,7 +1,7 @@ target "jgit-4.12" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/2019-06/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index 14df61ad1..c79f20669 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd index 323aabb87..e46a5dfe4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd @@ -1,7 +1,7 @@ target "jgit-4.13" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index 01460fedf..39f52ace3 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd index 67ea4ea88..d1f0d49cc 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd @@ -1,7 +1,7 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/staging/2019-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 13572d838..4d862e2c1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index 455dc96d5..eb3f96d3b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,7 +1,7 @@ target "jgit-4.6" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/neon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 966f77f03..780b668ad 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index e50501f82..cb98e4c87 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,7 +1,7 @@ target "jgit-4.7" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/oxygen/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index e64ce3beb..596cd6915 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd index be46cf9db..e0d886adf 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd @@ -1,7 +1,7 @@ target "jgit-4.8" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/photon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index 42138b179..7da901f04 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -70,8 +70,8 @@ - - + + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd index cc77ea3ee..32321d874 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd @@ -1,7 +1,7 @@ target "jgit-4.9" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/I20200126235943.tpd" +include "orbit/staging-2020-03.tpd" location "http://download.eclipse.org/releases/2018-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd similarity index 95% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd index 5ca0a9360..9269a642c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/I20200126235943.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd @@ -1,7 +1,7 @@ -target "I20200126235943" with source configurePhase +target "staging-2020-03" with source configurePhase // see http://download.eclipse.org/tools/orbit/downloads/ -location "https://download.eclipse.org/tools/orbit/downloads/drops/I20200126235943/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository" { com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] @@ -49,8 +49,8 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/I202001262359 org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519] org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246] org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246] - org.junit [4.13.0.v20200126-2018,4.13.0.v20200126-2018] - org.junit.source [4.13.0.v20200126-2018,4.13.0.v20200126-2018] + org.junit [4.13.0.v20200128-1312,4.13.0.v20200128-1312] + org.junit.source [4.13.0.v20200128-1312,4.13.0.v20200128-1312] org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218] org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420] From 2a134e1541ff49f640061db2c3ea89ab3305c7a6 Mon Sep 17 00:00:00 2001 From: Joshua Redstone Date: Fri, 31 Jan 2020 13:14:42 -0600 Subject: [PATCH 18/22] AmazonS3: Speed up fetch, try recent packs first When fetching remote objects, WalkFetchConnection searches remote packs in the order provided by WalkRemoteObjectDatabase:getPackNames. Previously, for TransportAmazonS3, the packs were in no particular order. This resulted in potential many extra calls to get pack idx files. This change modifies TransportAmazonS3 and AmazonS3 so that getPackNames returns a list sorted with the most recently modified packs first. In the case of fetching recent changes to a repo, this dramatically reduces the number of packs searched and speeds up fetch. Note: WalkRemoteObjectDatabase::getPackNames does not specify the order of the returned names. Testing: did "mvn clean install" in root dir and all tests passed. And manually constructed some S3 repos and using jgit.sh confirmed that the freshest pack was checked first. Change-Id: I3b968fee825e793be55566e28c2d69d0cbe53807 Signed-off-by: Joshua Redstone Signed-off-by: Matthias Sohn --- .../org/eclipse/jgit/transport/AmazonS3.java | 55 ++++++++++++++++--- .../jgit/transport/TransportAmazonS3.java | 8 ++- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 1e7f3b1f0..9210ec172 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -33,6 +33,7 @@ import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.HashSet; import java.util.Iterator; @@ -44,6 +45,8 @@ import java.util.Set; import java.util.SortedMap; import java.util.TimeZone; import java.util.TreeMap; +import java.util.stream.Collectors; +import java.time.Instant; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -288,6 +291,8 @@ public class AmazonS3 { *

* This method is primarily meant for obtaining a "recursive directory * listing" rooted under the specified bucket and prefix location. + * It returns the keys sorted in reverse order of LastModified time + * (freshest keys first). * * @param bucket * name of the bucket whose objects should be listed. @@ -311,7 +316,10 @@ public class AmazonS3 { do { lp.list(); } while (lp.truncated); - return lp.entries; + + Comparator comparator = Comparator.comparingLong(KeyInfo::getLastModifiedSecs); + return lp.entries.stream().sorted(comparator.reversed()) + .map(KeyInfo::getName).collect(Collectors.toList()); } /** @@ -620,8 +628,26 @@ public class AmazonS3 { return p; } + /** + * KeyInfo enables sorting of keys by lastModified time + */ + private static final class KeyInfo { + private final String name; + private final long lastModifiedSecs; + public KeyInfo(String aname, long lsecs) { + name = aname; + lastModifiedSecs = lsecs; + } + public String getName() { + return name; + } + public long getLastModifiedSecs() { + return lastModifiedSecs; + } + } + private final class ListParser extends DefaultHandler { - final List entries = new ArrayList<>(); + final List entries = new ArrayList<>(); private final String bucket; @@ -630,6 +656,8 @@ public class AmazonS3 { boolean truncated; private StringBuilder data; + private String keyName; + private Instant keyLastModified; ListParser(String bn, String p) { bucket = bn; @@ -641,7 +669,7 @@ public class AmazonS3 { if (prefix.length() > 0) args.put("prefix", prefix); //$NON-NLS-1$ if (!entries.isEmpty()) - args.put("marker", prefix + entries.get(entries.size() - 1)); //$NON-NLS-1$ + args.put("marker", prefix + entries.get(entries.size() - 1).getName()); //$NON-NLS-1$ for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { final HttpURLConnection c = open("GET", bucket, "", args); //$NON-NLS-1$ //$NON-NLS-2$ @@ -650,6 +678,8 @@ public class AmazonS3 { case HttpURLConnection.HTTP_OK: truncated = false; data = null; + keyName = null; + keyLastModified = null; final XMLReader xr; try { @@ -683,8 +713,13 @@ public class AmazonS3 { public void startElement(final String uri, final String name, final String qName, final Attributes attributes) throws SAXException { - if ("Key".equals(name) || "IsTruncated".equals(name)) //$NON-NLS-1$ //$NON-NLS-2$ + if ("Key".equals(name) || "IsTruncated".equals(name) || "LastModified".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ data = new StringBuilder(); + } + if ("Contents".equals(name)) { //$NON-NLS-1$ + keyName = null; + keyLastModified = null; + } } @Override @@ -704,10 +739,16 @@ public class AmazonS3 { @Override public void endElement(final String uri, final String name, final String qName) throws SAXException { - if ("Key".equals(name)) //$NON-NLS-1$ - entries.add(data.toString().substring(prefix.length())); - else if ("IsTruncated".equals(name)) //$NON-NLS-1$ + if ("Key".equals(name)) { //$NON-NLS-1$ + keyName = data.toString().substring(prefix.length()); + } else if ("IsTruncated".equals(name)) { //$NON-NLS-1$ truncated = StringUtils.equalsIgnoreCase("true", data.toString()); //$NON-NLS-1$ + } else if ("LastModified".equals(name)) { //$NON-NLS-1$ + keyLastModified = Instant.parse(data.toString()); + } else if ("Contents".equals(name)) { //$NON-NLS-1$ + entries.add(new KeyInfo(keyName, keyLastModified.getEpochSecond())); + } + data = null; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java index 94f36d285..784f56615 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -241,11 +242,14 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { @Override Collection getPackNames() throws IOException { + // s3.list returns most recently modified packs first. + // These are the packs most likely to contain missing refs. + final List packList = s3.list(bucket, resolveKey("pack")); //$NON-NLS-1$ final HashSet have = new HashSet<>(); - have.addAll(s3.list(bucket, resolveKey("pack"))); //$NON-NLS-1$ + have.addAll(packList); final Collection packs = new ArrayList<>(); - for (String n : have) { + for (String n : packList) { if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$ continue; From 730b7a5ebf149e8df085a19ce4d4eddcea5958dd Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 1 Feb 2020 16:48:41 +0100 Subject: [PATCH 19/22] Update Maven plugins - maven-surefire-plugin to 3.0.0-M4 - japicmp-maven-plugin to 0.14.3 Change-Id: I9191620825e15b03a58c41cf3d3e64c6a58faf0f Signed-off-by: Matthias Sohn --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 06e2f308a..68a943038 100644 --- a/pom.xml +++ b/pom.xml @@ -163,7 +163,7 @@ 4.3.1 3.1.0 9.4.25.v20191220 - 0.14.1 + 0.14.3 4.5.10 4.4.12 1.7.2 @@ -175,7 +175,7 @@ 3.1.12.2 3.0.0 3.0.0 - 3.0.0-M3 + 3.0.0-M4 ${maven-surefire-plugin-version} 3.8.1 From 708525c67e008acc33dd8259cdcf11d2f3e9107b Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 2 Feb 2020 22:28:22 +0100 Subject: [PATCH 20/22] Include org.apache.commons.codec 1.13 in the JGit http.apache.feature We do include httpcomponents.httpclient, but that depends on commons.codec. By including it here we can ensure that the version needed is indeed available. Bug: 559735 Change-Id: I16ef830cfe4f8e3b8a8ca08476fd655f41eee51b Signed-off-by: Thomas Wolf --- .../org.eclipse.jgit.http.apache.feature/feature.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml index 17a732b4a..8da600137 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml @@ -47,4 +47,11 @@ version="0.0.0" unpack="false"/> + + From 614d8a15b98643839f4d4abb6f5927530a79ed66 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 4 Feb 2020 18:54:23 +0900 Subject: [PATCH 21/22] Upgrade maven-pmd-plugin to 3.13.0 Change-Id: I6e20b77db743cd8578aa1f8688f893b746e861d1 Signed-off-by: David Pursehouse --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 68a943038..d0a5c83a1 100644 --- a/pom.xml +++ b/pom.xml @@ -298,7 +298,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.12.0 + 3.13.0 utf-8 100 From 9d1e47741780bf74ccd8a65643bc90791a5b0177 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Thu, 19 Dec 2019 21:09:45 +0100 Subject: [PATCH 22/22] Use lambdas where possible Using the batch cleanup operation via Source -> Cleanup -> "Use lambdas where possible" from standard JDT. Change-Id: I5452bd94fdccc920ade071228aeed3a8b9fdbe62 Signed-off-by: Lars Vogel --- .../jgit/internal/storage/file/PackFile.java | 13 ++-- .../internal/storage/pack/PackWriter.java | 65 +++++++++---------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java index 984c16366..b99733875 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java @@ -71,13 +71,12 @@ import org.slf4j.LoggerFactory; */ public class PackFile implements Iterable { private final static Logger LOG = LoggerFactory.getLogger(PackFile.class); - /** Sorts PackFiles to be most recently created to least recently created. */ - public static final Comparator SORT = new Comparator() { - @Override - public int compare(PackFile a, PackFile b) { - return b.packLastModified.compareTo(a.packLastModified); - } - }; + + /** + * Sorts PackFiles to be most recently created to least recently created. + */ + public static final Comparator SORT = (a, b) -> b.packLastModified + .compareTo(a.packLastModified); private final File packFile; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 9a6ec760b..e8f0e1fd9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -142,43 +142,42 @@ public class PackWriter implements AutoCloseable { private static final Map, Boolean> instances = new ConcurrentHashMap<>(); - private static final Iterable instancesIterable = new Iterable() { + private static final Iterable instancesIterable = () -> new Iterator() { + + private final Iterator> it = instances + .keySet().iterator(); + + private PackWriter next; + @Override - public Iterator iterator() { - return new Iterator() { - private final Iterator> it = - instances.keySet().iterator(); - private PackWriter next; - - @Override - public boolean hasNext() { - if (next != null) - return true; - while (it.hasNext()) { - WeakReference ref = it.next(); - next = ref.get(); - if (next != null) - return true; - it.remove(); - } - return false; + public boolean hasNext() { + if (next != null) { + return true; + } + while (it.hasNext()) { + WeakReference ref = it.next(); + next = ref.get(); + if (next != null) { + return true; } + it.remove(); + } + return false; + } - @Override - public PackWriter next() { - if (hasNext()) { - PackWriter result = next; - next = null; - return result; - } - throw new NoSuchElementException(); - } + @Override + public PackWriter next() { + if (hasNext()) { + PackWriter result = next; + next = null; + return result; + } + throw new NoSuchElementException(); + } - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - }; + @Override + public void remove() { + throw new UnsupportedOperationException(); } };