Use slf4j to log instead of printing to System.err
CQ: 9206 Bug: 458445 Change-Id: Ic68fb7dbe0fb46bf30f157db45bf18d8f3a704c0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
af4bde1ed2
commit
c18694e0d1
|
@ -63,4 +63,11 @@
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
|
<plugin
|
||||||
|
id="org.slf4j.api"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"
|
||||||
|
unpack="false"/>
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?pde?>
|
<?pde?>
|
||||||
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
||||||
<target name="jgit-4.3" sequenceNumber="1424128174">
|
<target name="jgit-4.3" sequenceNumber="1424129461">
|
||||||
<locations>
|
<locations>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
||||||
|
@ -53,6 +53,8 @@
|
||||||
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
||||||
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
||||||
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
||||||
|
<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
|
||||||
|
<unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
|
||||||
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/"/>
|
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/"/>
|
||||||
</location>
|
</location>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?pde?>
|
<?pde?>
|
||||||
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
||||||
<target name="jgit-4.4" sequenceNumber="1424128038">
|
<target name="jgit-4.4" sequenceNumber="1424129435">
|
||||||
<locations>
|
<locations>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
||||||
|
@ -53,6 +53,8 @@
|
||||||
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
||||||
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
||||||
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
||||||
|
<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
|
||||||
|
<unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
|
||||||
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/"/>
|
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/"/>
|
||||||
</location>
|
</location>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?pde?>
|
<?pde?>
|
||||||
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
|
||||||
<target name="jgit-4.5" sequenceNumber="1424127977">
|
<target name="jgit-4.5" sequenceNumber="1424129206">
|
||||||
<locations>
|
<locations>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
<unit id="org.eclipse.jetty.client" version="7.6.14.v20131031"/>
|
||||||
|
@ -53,6 +53,8 @@
|
||||||
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
<unit id="javax.servlet.source" version="2.5.0.v201103041518"/>
|
||||||
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz" version="1.3.0.v201308270617"/>
|
||||||
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
<unit id="org.tukaani.xz.source" version="1.3.0.v201308270617"/>
|
||||||
|
<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
|
||||||
|
<unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
|
||||||
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20150202203538/repository/"/>
|
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20150202203538/repository/"/>
|
||||||
</location>
|
</location>
|
||||||
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
|
||||||
|
|
|
@ -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]
|
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 [1.3.0.v201308270617,1.3.0.v201308270617]
|
||||||
org.tukaani.xz.source [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]
|
||||||
}
|
}
|
|
@ -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]
|
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 [1.3.0.v201308270617,1.3.0.v201308270617]
|
||||||
org.tukaani.xz.source [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]
|
||||||
}
|
}
|
|
@ -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)",
|
Import-Package: com.googlecode.javaewah;version="[0.7.9,0.8.0)",
|
||||||
javax.crypto,
|
javax.crypto,
|
||||||
javax.net.ssl,
|
javax.net.ssl,
|
||||||
|
org.slf4j;version="[1.7.0,2.0.0)",
|
||||||
org.xml.sax,
|
org.xml.sax,
|
||||||
org.xml.sax.helpers
|
org.xml.sax.helpers
|
||||||
|
|
|
@ -83,6 +83,11 @@
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -85,6 +83,8 @@
|
||||||
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
|
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
|
||||||
import org.eclipse.jgit.util.FS;
|
import org.eclipse.jgit.util.FS;
|
||||||
import org.eclipse.jgit.util.FileUtils;
|
import org.eclipse.jgit.util.FileUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traditional file system based {@link ObjectDatabase}.
|
* Traditional file system based {@link ObjectDatabase}.
|
||||||
|
@ -105,6 +105,9 @@
|
||||||
* considered.
|
* considered.
|
||||||
*/
|
*/
|
||||||
public class ObjectDirectory extends FileObjectDatabase {
|
public class ObjectDirectory extends FileObjectDatabase {
|
||||||
|
private final static Logger LOG = LoggerFactory
|
||||||
|
.getLogger(ObjectDirectory.class);
|
||||||
|
|
||||||
private static final PackList NO_PACKS = new PackList(
|
private static final PackList NO_PACKS = new PackList(
|
||||||
FileSnapshot.DIRTY, new PackFile[0]);
|
FileSnapshot.DIRTY, new PackFile[0]);
|
||||||
|
|
||||||
|
@ -565,14 +568,8 @@ private void handlePackError(IOException e, PackFile p) {
|
||||||
// Don't remove the pack from the list, as the error may be
|
// Don't remove the pack from the list, as the error may be
|
||||||
// transient.
|
// transient.
|
||||||
}
|
}
|
||||||
StringBuilder buf = new StringBuilder(MessageFormat.format(tmpl,
|
LOG.error(MessageFormat.format(tmpl,
|
||||||
p.getPackFile().getAbsolutePath()));
|
p.getPackFile().getAbsolutePath()), e);
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,6 +69,8 @@
|
||||||
import org.eclipse.jgit.lib.Constants;
|
import org.eclipse.jgit.lib.Constants;
|
||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
import org.eclipse.jgit.util.ProcessResult.Status;
|
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. */
|
/** Abstraction to support various file system operations not in Java. */
|
||||||
public abstract class FS {
|
public abstract class FS {
|
||||||
|
@ -107,6 +109,8 @@ public FS detect(Boolean cygwinUsed) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(FS.class);
|
||||||
|
|
||||||
/** The auto-detected implementation selected for this operating system and JRE. */
|
/** The auto-detected implementation selected for this operating system and JRE. */
|
||||||
public static final FS DETECTED = detect();
|
public static final FS DETECTED = detect();
|
||||||
|
|
||||||
|
@ -418,12 +422,12 @@ protected static File searchPath(final String path, final String... lookFor) {
|
||||||
* @return the one-line output of the command
|
* @return the one-line output of the command
|
||||||
*/
|
*/
|
||||||
protected static String readPipe(File dir, String[] command, String encoding) {
|
protected static String readPipe(File dir, String[] command, String encoding) {
|
||||||
final boolean debug = Boolean.parseBoolean(SystemReader.getInstance()
|
final boolean debug = LOG.isDebugEnabled();
|
||||||
.getProperty("jgit.fs.debug")); //$NON-NLS-1$
|
|
||||||
try {
|
try {
|
||||||
if (debug)
|
if (debug) {
|
||||||
System.err.println("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$
|
LOG.debug("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
+ dir);
|
+ dir);
|
||||||
|
}
|
||||||
final Process p = Runtime.getRuntime().exec(command, null, dir);
|
final Process p = Runtime.getRuntime().exec(command, null, dir);
|
||||||
final BufferedReader lineRead = new BufferedReader(
|
final BufferedReader lineRead = new BufferedReader(
|
||||||
new InputStreamReader(p.getInputStream(), encoding));
|
new InputStreamReader(p.getInputStream(), encoding));
|
||||||
|
@ -451,8 +455,9 @@ public void run() {
|
||||||
is.close();
|
is.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Just print on stderr for debugging
|
// Just print on stderr for debugging
|
||||||
if (debug)
|
if (debug) {
|
||||||
e.printStackTrace(System.err);
|
LOG.debug("Caught exception in gobbler thread", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
gooblerFail.set(true);
|
gooblerFail.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,13 +467,14 @@ public void run() {
|
||||||
try {
|
try {
|
||||||
r = lineRead.readLine();
|
r = lineRead.readLine();
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.err.println("readpipe may return '" + r + "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
LOG.debug("readpipe may return '" + r + "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
System.err.println("(ignoring remaing output:"); //$NON-NLS-1$
|
LOG.debug("(ignoring remaing output:"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String l;
|
String l;
|
||||||
while ((l = lineRead.readLine()) != null) {
|
while ((l = lineRead.readLine()) != null) {
|
||||||
if (debug)
|
if (debug) {
|
||||||
System.err.println(l);
|
LOG.debug(l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
p.getErrorStream().close();
|
p.getErrorStream().close();
|
||||||
|
@ -482,20 +488,20 @@ public void run() {
|
||||||
if (rc == 0 && r != null && r.length() > 0
|
if (rc == 0 && r != null && r.length() > 0
|
||||||
&& !gooblerFail.get())
|
&& !gooblerFail.get())
|
||||||
return r;
|
return r;
|
||||||
if (debug)
|
if (debug) {
|
||||||
System.err.println("readpipe rc=" + rc); //$NON-NLS-1$
|
LOG.debug("readpipe rc=" + rc); //$NON-NLS-1$
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
// Stop bothering me, I have a zombie to reap.
|
// Stop bothering me, I have a zombie to reap.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (debug)
|
LOG.error("Caught exception in FS.readPipe()", e); //$NON-NLS-1$
|
||||||
System.err.println(e);
|
}
|
||||||
// Ignore error (but report)
|
if (debug) {
|
||||||
|
LOG.debug("readpipe returns null"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (debug)
|
|
||||||
System.err.println("readpipe returns null"); //$NON-NLS-1$
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -189,6 +189,7 @@
|
||||||
<jetty-version>7.6.14.v20131031</jetty-version>
|
<jetty-version>7.6.14.v20131031</jetty-version>
|
||||||
<clirr-version>2.6.1</clirr-version>
|
<clirr-version>2.6.1</clirr-version>
|
||||||
<httpclient-version>4.1.3</httpclient-version>
|
<httpclient-version>4.1.3</httpclient-version>
|
||||||
|
<slf4j-version>1.7.2</slf4j-version>
|
||||||
<maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
|
<maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
|
||||||
|
|
||||||
<!-- Properties to enable jacoco code coverage analysis -->
|
<!-- Properties to enable jacoco code coverage analysis -->
|
||||||
|
@ -543,6 +544,11 @@
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
<version>${httpclient-version}</version>
|
<version>${httpclient-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j-version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue