From af4bde1ed257c9f0311fc31e14c2f3087ea8e928 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 17 Feb 2015 00:12:01 +0100 Subject: [PATCH 1/3] Use Target Platform Definition DSL to generate target platforms The "Target Platform Definition DSL and Generator" [1] heavily simplifies maintenance of target platforms. It allows to modularize target platform definitions which eliminates code duplication. The .target files understood by P2 and Tycho are generated from .tpd files which are written in the target platform definition DSL. In order to edit .tpd files and generate .target files install the "Target Platform Definition DSL and Generator" 2.0 or later [2] (Note: on Kepler you also need to add [3] to get Xtext 2.5 which is not available by default on Kepler). This tools is needed only if you need to change the Target Platform definition files (*.targetplatform and *.tpd) and re-generate the *.target files. In normal development you do not need this and can simply use the generated *.target themselves. In addition - update Orbit repository for 4.5 to Mars M5 - use latest released Orbit p2 repository for platform version Luna and earlier [1] https://github.com/mbarbero/fr.obeo.releng.targetplatform [2] http://mbarbero.github.io/fr.obeo.releng.targetplatform/p2/latest/ [3] http://download.eclipse.org/modeling/tmf/xtext/updates/releases/ Change-Id: Ia701972785c3e88aba66a7f15a2b3cf638727eea Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.3.target | 33 +++++++---------- .../org.eclipse.jgit.target/jgit-4.3.tpd | 8 +++++ .../org.eclipse.jgit.target/jgit-4.4.target | 31 +++++++--------- .../org.eclipse.jgit.target/jgit-4.4.tpd | 8 +++++ .../org.eclipse.jgit.target/jgit-4.5.target | 31 +++++++--------- .../org.eclipse.jgit.target/jgit-4.5.tpd | 8 +++++ .../orbit/R20150124073747-Luna-SR2.tpd | 35 +++++++++++++++++++ .../orbit/S20150202203538-Mars-M5.tpd | 35 +++++++++++++++++++ .../projects/jetty-7.6.14.tpd | 20 +++++++++++ 9 files changed, 151 insertions(+), 58 deletions(-) create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-7.6.14.tpd diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target index 9bf94ccc8..c0eff7da4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target @@ -1,17 +1,9 @@ - - - + + + - - + @@ -28,11 +20,11 @@ + - - - - + + + @@ -53,18 +45,19 @@ - - + + + - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.tpd new file mode 100644 index 000000000..1d16481cd --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.tpd @@ -0,0 +1,8 @@ +target "jgit-4.3" with source configurePhase + +include "projects/jetty-7.6.14.tpd" +include "orbit/R20150124073747-Luna-SR2.tpd" + +location "http://download.eclipse.org/releases/kepler/" { + org.eclipse.osgi lazy +} diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target index 2645b1636..c414f4152 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target @@ -1,17 +1,9 @@ - - - + + + - - + @@ -28,11 +20,11 @@ + - - - + + @@ -53,18 +45,19 @@ - - + + + - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.tpd new file mode 100644 index 000000000..afbe9c9f7 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.tpd @@ -0,0 +1,8 @@ +target "jgit-4.4" with source configurePhase + +include "projects/jetty-7.6.14.tpd" +include "orbit/R20150124073747-Luna-SR2.tpd" + +location "http://download.eclipse.org/releases/luna/" { + org.eclipse.osgi lazy +} \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target index 1ba912232..45dec35ae 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target @@ -1,17 +1,9 @@ - - - + + + - - + @@ -28,11 +20,11 @@ + - - - + + @@ -53,18 +45,19 @@ - - + + + - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd new file mode 100644 index 000000000..33b088a68 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd @@ -0,0 +1,8 @@ +target "jgit-4.5" with source configurePhase + +include "projects/jetty-7.6.14.tpd" +include "orbit/S20150202203538-Mars-M5.tpd" + +location "http://download.eclipse.org/releases/mars/" { + org.eclipse.osgi lazy +} \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd new file mode 100644 index 000000000..5384a9a21 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd @@ -0,0 +1,35 @@ +target "R20150124073747" with source configurePhase +// see http://download.eclipse.org/tools/orbit/downloads/ + +location "http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/" { + org.apache.ant [1.9.2.v201404171502,1.9.2.v201404171502] + org.apache.ant.source [1.9.2.v201404171502,1.9.2.v201404171502] + org.apache.commons.compress [1.6.0.v201310281400,1.6.0.v201310281400] + org.apache.commons.compress.source [1.6.0.v201310281400,1.6.0.v201310281400] + org.apache.commons.logging [1.1.1.v201101211721,1.1.1.v201101211721] + org.apache.commons.logging.source [1.1.1.v201101211721,1.1.1.v201101211721] + org.apache.httpcomponents.httpcore [4.1.4.v201203221030,4.1.4.v201203221030] + org.apache.httpcomponents.httpcore.source [4.1.4.v201203221030,4.1.4.v201203221030] + org.apache.httpcomponents.httpclient [4.1.3.v201209201135,4.1.3.v201209201135] + org.apache.httpcomponents.httpclient.source [4.1.3.v201209201135,4.1.3.v201209201135] + org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815] + org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815] + org.kohsuke.args4j [2.0.21.v201301150030,2.0.21.v201301150030] + org.kohsuke.args4j.source [2.0.21.v201301150030,2.0.21.v201301150030] + org.hamcrest.core [1.3.0.v201303031735,1.3.0.v201303031735] + org.hamcrest.core.source [1.3.0.v201303031735,1.3.0.v201303031735] + javaewah [0.7.9.v201401101600,0.7.9.v201401101600] + javaewah.source [0.7.9.v201401101600,0.7.9.v201401101600] + org.objenesis [1.0.0.v201105211943,1.0.0.v201105211943] + org.objenesis.source [1.0.0.v201105211943,1.0.0.v201105211943] + org.mockito [1.8.4.v201303031500,1.8.4.v201303031500] + org.mockito.source [1.8.4.v201303031500,1.8.4.v201303031500] + com.jcraft.jsch [0.1.51.v201410302000,0.1.51.v201410302000] + com.jcraft.jsch.source [0.1.51.v201410302000,0.1.51.v201410302000] + org.junit [4.11.0.v201303080030,4.11.0.v201303080030] + org.junit.source [4.11.0.v201303080030,4.11.0.v201303080030] + javax.servlet [2.5.0.v201103041518,2.5.0.v201103041518] + javax.servlet.source [2.5.0.v201103041518,2.5.0.v201103041518] + org.tukaani.xz [1.3.0.v201308270617,1.3.0.v201308270617] + org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] +} \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd new file mode 100644 index 000000000..d41a5f4df --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd @@ -0,0 +1,35 @@ +target "S20141023165154-Mars-M3" with source configurePhase +// see http://download.eclipse.org/tools/orbit/downloads/ + +location "http://download.eclipse.org/tools/orbit/downloads/drops/S20150202203538/repository/" { + org.apache.ant [1.9.4.v201410062020,1.9.4.v201410062020] + org.apache.ant.source [1.9.4.v201410062020,1.9.4.v201410062020] + org.apache.commons.compress [1.6.0.v201310281400,1.6.0.v201310281400] + org.apache.commons.compress.source [1.6.0.v201310281400,1.6.0.v201310281400] + org.apache.commons.logging [1.1.1.v201101211721,1.1.1.v201101211721] + org.apache.commons.logging.source [1.1.1.v201101211721,1.1.1.v201101211721] + org.apache.httpcomponents.httpcore [4.1.4.v201203221030,4.1.4.v201203221030] + org.apache.httpcomponents.httpcore.source [4.1.4.v201203221030,4.1.4.v201203221030] + org.apache.httpcomponents.httpclient [4.1.3.v201209201135,4.1.3.v201209201135] + org.apache.httpcomponents.httpclient.source [4.1.3.v201209201135,4.1.3.v201209201135] + org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815] + org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815] + org.kohsuke.args4j [2.0.21.v201301150030,2.0.21.v201301150030] + org.kohsuke.args4j.source [2.0.21.v201301150030,2.0.21.v201301150030] + org.hamcrest.core [1.3.0.v201303031735,1.3.0.v201303031735] + org.hamcrest.core.source [1.3.0.v201303031735,1.3.0.v201303031735] + javaewah [0.7.9.v201401101600,0.7.9.v201401101600] + javaewah.source [0.7.9.v201401101600,0.7.9.v201401101600] + org.objenesis [1.0.0.v201105211943,1.0.0.v201105211943] + org.objenesis.source [1.0.0.v201105211943,1.0.0.v201105211943] + org.mockito [1.8.4.v201303031500,1.8.4.v201303031500] + org.mockito.source [1.8.4.v201303031500,1.8.4.v201303031500] + com.jcraft.jsch [0.1.51.v201410302000,0.1.51.v201410302000] + com.jcraft.jsch.source [0.1.51.v201410302000,0.1.51.v201410302000] + org.junit [4.11.0.v201303080030,4.11.0.v201303080030] + org.junit.source [4.11.0.v201303080030,4.11.0.v201303080030] + javax.servlet [2.5.0.v201103041518,2.5.0.v201103041518] + javax.servlet.source [2.5.0.v201103041518,2.5.0.v201103041518] + org.tukaani.xz [1.3.0.v201308270617,1.3.0.v201308270617] + org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] +} \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-7.6.14.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-7.6.14.tpd new file mode 100644 index 000000000..2e338d637 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-7.6.14.tpd @@ -0,0 +1,20 @@ +target "jetty-7.6.14" with source configurePhase + +location jetty-7.6.14 "http://download.eclipse.org/jetty/updates/jetty-bundles-7.x/7.6.14.v20131031/" { + org.eclipse.jetty.client [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.client.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.continuation [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.continuation.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.http [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.http.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.io [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.io.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.security [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.security.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.server [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.server.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.servlet [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.servlet.source [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.util [7.6.14.v20131031,7.6.14.v20131031] + org.eclipse.jetty.util.source [7.6.14.v20131031,7.6.14.v20131031] +} From c18694e0d1c122a2f95537fd9254fb075d2e0bc2 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 9 Feb 2015 21:54:58 +0100 Subject: [PATCH 2/3] Use slf4j to log instead of printing to System.err CQ: 9206 Bug: 458445 Change-Id: Ic68fb7dbe0fb46bf30f157db45bf18d8f3a704c0 Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.feature/feature.xml | 7 ++++ .../org.eclipse.jgit.target/jgit-4.3.target | 4 +- .../org.eclipse.jgit.target/jgit-4.4.target | 4 +- .../org.eclipse.jgit.target/jgit-4.5.target | 4 +- .../orbit/R20150124073747-Luna-SR2.tpd | 2 + .../orbit/S20150202203538-Mars-M5.tpd | 2 + org.eclipse.jgit/META-INF/MANIFEST.MF | 1 + org.eclipse.jgit/pom.xml | 5 +++ .../storage/file/ObjectDirectory.java | 17 ++++---- .../src/org/eclipse/jgit/util/FS.java | 40 +++++++++++-------- pom.xml | 6 +++ 11 files changed, 62 insertions(+), 30 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml index 10ea2c9e5..def154171 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml @@ -63,4 +63,11 @@ version="0.0.0" unpack="false"/> + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target index c0eff7da4..76361d88f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target @@ -1,7 +1,7 @@ - + @@ -53,6 +53,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target index c414f4152..8f7053d05 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target @@ -1,7 +1,7 @@ - + @@ -53,6 +53,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target index 45dec35ae..4909416f7 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target @@ -1,7 +1,7 @@ - + @@ -53,6 +53,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd index 5384a9a21..683a8c7ce 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd @@ -32,4 +32,6 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/R2015012407374 javax.servlet.source [2.5.0.v201103041518,2.5.0.v201103041518] org.tukaani.xz [1.3.0.v201308270617,1.3.0.v201308270617] org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] + 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] } \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd index d41a5f4df..415fdca5d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd @@ -32,4 +32,6 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/S2015020220353 javax.servlet.source [2.5.0.v201103041518,2.5.0.v201103041518] org.tukaani.xz [1.3.0.v201308270617,1.3.0.v201308270617] org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] + 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] } \ No newline at end of file diff --git a/org.eclipse.jgit/META-INF/MANIFEST.MF b/org.eclipse.jgit/META-INF/MANIFEST.MF index eea13ec7b..55ef0605b 100644 --- a/org.eclipse.jgit/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit/META-INF/MANIFEST.MF @@ -147,5 +147,6 @@ Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)" Import-Package: com.googlecode.javaewah;version="[0.7.9,0.8.0)", javax.crypto, javax.net.ssl, + org.slf4j;version="[1.7.0,2.0.0)", org.xml.sax, org.xml.sax.helpers diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml index 36a579ec2..6ca299ed5 100644 --- a/org.eclipse.jgit/pom.xml +++ b/org.eclipse.jgit/pom.xml @@ -83,6 +83,11 @@ org.apache.httpcomponents httpclient + + + org.slf4j + slf4j-api + 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 adbe1f865..687408e19 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 @@ -52,8 +52,6 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; @@ -85,6 +83,8 @@ import org.eclipse.jgit.lib.RepositoryCache; import org.eclipse.jgit.lib.RepositoryCache.FileKey; import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Traditional file system based {@link ObjectDatabase}. @@ -105,6 +105,9 @@ import org.eclipse.jgit.util.FileUtils; * considered. */ public class ObjectDirectory extends FileObjectDatabase { + private final static Logger LOG = LoggerFactory + .getLogger(ObjectDirectory.class); + private static final PackList NO_PACKS = new PackList( FileSnapshot.DIRTY, new PackFile[0]); @@ -565,14 +568,8 @@ public class ObjectDirectory extends FileObjectDatabase { // Don't remove the pack from the list, as the error may be // transient. } - StringBuilder buf = new StringBuilder(MessageFormat.format(tmpl, - p.getPackFile().getAbsolutePath())); - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - buf.append('\n'); - buf.append(sw.toString()); - // TODO instead of syserr we should use a logging framework - System.err.println(buf.toString()); + LOG.error(MessageFormat.format(tmpl, + p.getPackFile().getAbsolutePath()), e); } @Override 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 081bf87c5..875e12f57 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -69,6 +69,8 @@ import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.util.ProcessResult.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** Abstraction to support various file system operations not in Java. */ public abstract class FS { @@ -107,6 +109,8 @@ public abstract class FS { } } + private final static Logger LOG = LoggerFactory.getLogger(FS.class); + /** The auto-detected implementation selected for this operating system and JRE. */ public static final FS DETECTED = detect(); @@ -418,12 +422,12 @@ public abstract class FS { * @return the one-line output of the command */ protected static String readPipe(File dir, String[] command, String encoding) { - final boolean debug = Boolean.parseBoolean(SystemReader.getInstance() - .getProperty("jgit.fs.debug")); //$NON-NLS-1$ + final boolean debug = LOG.isDebugEnabled(); try { - if (debug) - System.err.println("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$ + if (debug) { + LOG.debug("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$ + dir); + } final Process p = Runtime.getRuntime().exec(command, null, dir); final BufferedReader lineRead = new BufferedReader( new InputStreamReader(p.getInputStream(), encoding)); @@ -451,8 +455,9 @@ public abstract class FS { is.close(); } catch (IOException e) { // Just print on stderr for debugging - if (debug) - e.printStackTrace(System.err); + if (debug) { + LOG.debug("Caught exception in gobbler thread", e); //$NON-NLS-1$ + } gooblerFail.set(true); } } @@ -462,13 +467,14 @@ public abstract class FS { try { r = lineRead.readLine(); if (debug) { - System.err.println("readpipe may return '" + r + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - System.err.println("(ignoring remaing output:"); //$NON-NLS-1$ + LOG.debug("readpipe may return '" + r + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + LOG.debug("(ignoring remaing output:"); //$NON-NLS-1$ } String l; while ((l = lineRead.readLine()) != null) { - if (debug) - System.err.println(l); + if (debug) { + LOG.debug(l); + } } } finally { p.getErrorStream().close(); @@ -482,20 +488,20 @@ public abstract class FS { if (rc == 0 && r != null && r.length() > 0 && !gooblerFail.get()) return r; - if (debug) - System.err.println("readpipe rc=" + rc); //$NON-NLS-1$ + if (debug) { + LOG.debug("readpipe rc=" + rc); //$NON-NLS-1$ + } break; } catch (InterruptedException ie) { // Stop bothering me, I have a zombie to reap. } } } catch (IOException e) { - if (debug) - System.err.println(e); - // Ignore error (but report) + LOG.error("Caught exception in FS.readPipe()", e); //$NON-NLS-1$ + } + if (debug) { + LOG.debug("readpipe returns null"); //$NON-NLS-1$ } - if (debug) - System.err.println("readpipe returns null"); //$NON-NLS-1$ return null; } diff --git a/pom.xml b/pom.xml index d222dc2ba..128d79377 100644 --- a/pom.xml +++ b/pom.xml @@ -189,6 +189,7 @@ 7.6.14.v20131031 2.6.1 4.1.3 + 1.7.2 2.9.1 @@ -543,6 +544,11 @@ httpclient ${httpclient-version} + + org.slf4j + slf4j-api + ${slf4j-version} + From a8743df19c2574bc3481fa5f811499b5960951a8 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 10 Feb 2015 11:58:19 +0100 Subject: [PATCH 3/3] Add log4j and slf4j-log4j bridge to jgit feature CQ: 9207 CQ: 9241 Change-Id: Ic06a06da0a74f8fa494c0753cbe9ed2356c21ab3 Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.feature/feature.xml | 15 +++++++++++++++ .../org.eclipse.jgit.target/jgit-4.3.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.4.target | 4 +++- .../org.eclipse.jgit.target/jgit-4.5.target | 4 +++- .../orbit/R20150124073747-Luna-SR2.tpd | 2 ++ .../orbit/S20150202203538-Mars-M5.tpd | 2 ++ pom.xml | 14 ++++++++++++++ 7 files changed, 42 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml index def154171..361b455a0 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml @@ -70,4 +70,19 @@ version="0.0.0" unpack="false"/> + + + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target index 76361d88f..44be1e513 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.3.target @@ -1,7 +1,7 @@ - + @@ -55,6 +55,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target index 8f7053d05..38e25a416 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.4.target @@ -1,7 +1,7 @@ - + @@ -55,6 +55,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target index 4909416f7..e5d14330e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target @@ -1,7 +1,7 @@ - + @@ -55,6 +55,8 @@ + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd index 683a8c7ce..d79b41ade 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20150124073747-Luna-SR2.tpd @@ -34,4 +34,6 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/R2015012407374 org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] 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] } \ No newline at end of file diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd index 415fdca5d..3ec1001c9 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20150202203538-Mars-M5.tpd @@ -34,4 +34,6 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/S2015020220353 org.tukaani.xz.source [1.3.0.v201308270617,1.3.0.v201308270617] 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] } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 128d79377..a60d863d3 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,7 @@ 2.6.1 4.1.3 1.7.2 + 1.2.15 2.9.1 @@ -544,11 +545,24 @@ httpclient ${httpclient-version} + org.slf4j slf4j-api ${slf4j-version} + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + log4j + log4j + ${log4j-version} +