aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorSaša Živkov <sasa.zivkov@sap.com>2017-10-27 12:29:52 +0200
committerSasa Zivkov <zivkov@gmail.com>2017-10-30 04:43:51 -0400
commit176466ed281f85f2ba92ae8b605fb43eb3e010d9 (patch)
treeb746128ad143078204e00014a5179bf8e0a1f01b /org.eclipse.jgit
parent7fcb7854b203495ca132df99e605367031cdbe9c (diff)
downloadjgit-176466ed281f85f2ba92ae8b605fb43eb3e010d9.tar.gz
jgit-176466ed281f85f2ba92ae8b605fb43eb3e010d9.zip
Move loggers to the top of their class
There is a possibility of hitting NPE on a logger if it is not the first statically initialized member. For example, if another static initializer creates an instance of its class and the logger is used from the constructor. Change-Id: I51fa855a8883c107f2e4ef5ac039dc12a571a7ae
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
index 53e9fe3c53..efbbfbce27 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
@@ -64,11 +64,11 @@ import org.slf4j.LoggerFactory;
/** Cache of active {@link Repository} instances. */
public class RepositoryCache {
- private static final RepositoryCache cache = new RepositoryCache();
-
private final static Logger LOG = LoggerFactory
.getLogger(RepositoryCache.class);
+ private static final RepositoryCache cache = new RepositoryCache();
+
/**
* Open an existing repository, reusing a cached instance if possible.
* <p>
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 1cc39bd46c..5cc8afc78b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -77,6 +77,8 @@ import org.slf4j.LoggerFactory;
/** Abstraction to support various file system operations not in Java. */
public abstract class FS {
+ private static final Logger LOG = LoggerFactory.getLogger(FS.class);
+
/**
* This class creates FS instances. It will be overridden by a Java7 variant
* if such can be detected in {@link #detect(Boolean)}.
@@ -158,8 +160,6 @@ 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();