Merge branch 'stable-5.6'

* stable-5.6:
  Cygwin expects forward slashes for commands to be run via sh.exe
  Make Logger instances final
  Move array designators from the variable to the type

Change-Id: I9a5dc570deb478525bf48ef526d8cba5b19418bf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-02-28 23:53:17 +01:00
commit 2161c1e5e4
18 changed files with 22 additions and 21 deletions

View File

@ -105,7 +105,7 @@ void service(HttpServletRequest req, HttpServletResponse rsp)
// build a request for them so RegexGroupFilter can pick // build a request for them so RegexGroupFilter can pick
// a different capture group later. Continue using the // a different capture group later. Continue using the
// first capture group as the path info. // first capture group as the path info.
WrappedRequest groups[] = new WrappedRequest[cur.groupCount()]; WrappedRequest[] groups = new WrappedRequest[cur.groupCount()];
for (int groupId = 1; groupId <= cur.groupCount(); groupId++) { for (int groupId = 1; groupId <= cur.groupCount(); groupId++) {
final int s = cur.start(groupId); final int s = cur.start(groupId);
final String path, info; final String path, info;

View File

@ -45,7 +45,7 @@
*/ */
public class RepeatRule implements TestRule { public class RepeatRule implements TestRule {
private static Logger LOG = Logger private static final Logger LOG = Logger
.getLogger(RepeatRule.class.getName()); .getLogger(RepeatRule.class.getName());
/** /**

View File

@ -60,7 +60,7 @@
* @since 4.3 * @since 4.3
*/ */
public abstract class LfsProtocolServlet extends HttpServlet { public abstract class LfsProtocolServlet extends HttpServlet {
private static Logger LOG = LoggerFactory private static final Logger LOG = LoggerFactory
.getLogger(LfsProtocolServlet.class); .getLogger(LfsProtocolServlet.class);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -34,7 +34,7 @@
*/ */
public class ObjectDownloadListener implements WriteListener { public class ObjectDownloadListener implements WriteListener {
private static Logger LOG = Logger private static final Logger LOG = Logger
.getLogger(ObjectDownloadListener.class.getName()); .getLogger(ObjectDownloadListener.class.getName());
private final AsyncContext context; private final AsyncContext context;

View File

@ -38,7 +38,7 @@
*/ */
public class ObjectUploadListener implements ReadListener { public class ObjectUploadListener implements ReadListener {
private static Logger LOG = Logger private static final Logger LOG = Logger
.getLogger(ObjectUploadListener.class.getName()); .getLogger(ObjectUploadListener.class.getName());
private final AsyncContext context; private final AsyncContext context;

View File

@ -88,7 +88,7 @@ private KeyPair loadKey(SessionContext session, Path path)
if (cache == null) { if (cache == null) {
return loadKey(session, resource, path, getPasswordFinder()); return loadKey(session, resource, path, getPasswordFinder());
} }
Throwable t[] = { null }; Throwable[] t = { null };
KeyPair key = cache.get(path, p -> { KeyPair key = cache.get(path, p -> {
try { try {
return loadKey(session, resource, p, getPasswordFinder()); return loadKey(session, resource, p, getPasswordFinder());

View File

@ -216,7 +216,7 @@ private static int parseChallenge(AuthenticationChallenge challenge,
start = nextStart + 1; start = nextStart + 1;
} else { } else {
if (header.charAt(nextStart) == '"') { if (header.charAt(nextStart) == '"') {
int nextEnd[] = { nextStart + 1 }; int[] nextEnd = { nextStart + 1 };
String value = scanQuotedString(header, nextStart + 1, String value = scanQuotedString(header, nextStart + 1,
nextEnd); nextEnd);
challenge.addArgument(header.substring(start, end), value); challenge.addArgument(header.substring(start, end), value);

View File

@ -415,7 +415,7 @@ public static RawText load(ObjectLoader ldr, int threshold)
} }
} }
byte data[]; byte[] data;
try { try {
data = new byte[(int)sz]; data = new byte[(int)sz];
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {

View File

@ -79,7 +79,8 @@
* This class handles checking out one or two trees merging with the index. * This class handles checking out one or two trees merging with the index.
*/ */
public class DirCacheCheckout { public class DirCacheCheckout {
private static Logger LOG = LoggerFactory.getLogger(DirCacheCheckout.class); private static final Logger LOG = LoggerFactory
.getLogger(DirCacheCheckout.class);
private static final int MAX_EXCEPTION_TEXT_SIZE = 10 * 1024; private static final int MAX_EXCEPTION_TEXT_SIZE = 10 * 1024;

View File

@ -649,7 +649,7 @@ public String toString() {
} }
} }
static List<Segment> segmentSizes(long sizes[]) { static List<Segment> segmentSizes(long[] sizes) {
List<Segment> segments = new ArrayList<>(); List<Segment> segments = new ArrayList<>();
Segment cur = new Segment(); Segment cur = new Segment();
for (int i = 0; i < sizes.length; i++) { for (int i = 0; i < sizes.length; i++) {
@ -669,7 +669,7 @@ static List<Segment> segmentSizes(long sizes[]) {
return segments; return segments;
} }
private static Optional<Segment> autoCompactCandidate(long sizes[]) { private static Optional<Segment> autoCompactCandidate(long[] sizes) {
if (sizes.length == 0) { if (sizes.length == 0) {
return Optional.empty(); return Optional.empty();
} }

View File

@ -191,7 +191,7 @@ public static Iterable<PackWriter> getInstances() {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
BlockList<ObjectToPack> objectsLists[] = new BlockList[OBJ_TAG + 1]; BlockList<ObjectToPack>[] objectsLists = new BlockList[OBJ_TAG + 1];
{ {
objectsLists[OBJ_COMMIT] = new BlockList<>(); objectsLists[OBJ_COMMIT] = new BlockList<>();
objectsLists[OBJ_TREE] = new BlockList<>(); objectsLists[OBJ_TREE] = new BlockList<>();
@ -236,7 +236,7 @@ public static Iterable<PackWriter> getInstances() {
private List<ObjectToPack> sortedByName; private List<ObjectToPack> sortedByName;
private byte packcsum[]; private byte[] packcsum;
private boolean deltaBaseAsOffset; private boolean deltaBaseAsOffset;

View File

@ -110,7 +110,7 @@ public enum MergeFailureReason {
* *
* @since 3.0 * @since 3.0
*/ */
protected String commitNames[]; protected String[] commitNames;
/** /**
* Index of the base tree within the {@link #tw tree walk}. * Index of the base tree within the {@link #tw tree walk}.

View File

@ -2378,12 +2378,12 @@ public void write(int b) throws IOException {
} }
@Override @Override
public void write(byte b[]) throws IOException { public void write(byte[] b) throws IOException {
out.write(b); out.write(b);
} }
@Override @Override
public void write(byte b[], int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len); out.write(b, off, len);
} }

View File

@ -2270,7 +2270,7 @@ public void run() {
void copy() throws IOException { void copy() throws IOException {
boolean writeFailure = false; boolean writeFailure = false;
byte buffer[] = new byte[4096]; byte[] buffer = new byte[4096];
int readBytes; int readBytes;
while ((readBytes = in.read(buffer)) != -1) { while ((readBytes = in.read(buffer)) != -1) {
// Do not try to write again after a failure, but keep // Do not try to write again after a failure, but keep

View File

@ -117,7 +117,7 @@ public ProcessBuilder runInShell(String cmd, String[] args) {
argv.add("sh.exe"); //$NON-NLS-1$ argv.add("sh.exe"); //$NON-NLS-1$
argv.add("-c"); //$NON-NLS-1$ argv.add("-c"); //$NON-NLS-1$
argv.add("$0 \"$@\""); //$NON-NLS-1$ argv.add("$0 \"$@\""); //$NON-NLS-1$
argv.add(cmd); argv.add(cmd.replace(File.separatorChar, '/'));
argv.addAll(Arrays.asList(args)); argv.addAll(Arrays.asList(args));
ProcessBuilder proc = new ProcessBuilder(); ProcessBuilder proc = new ProcessBuilder();
proc.command(argv); proc.command(argv);

View File

@ -280,7 +280,7 @@ public int read() throws IOException {
} }
@Override @Override
public int read(byte b[], int off, int len) throws IOException { public int read(byte[] b, int off, int len) throws IOException {
return stream.read(b, off, len); return stream.read(b, off, len);
} }

View File

@ -49,7 +49,7 @@ public class Monitoring {
String metricName) { String metricName) {
boolean register = false; boolean register = false;
try { try {
Class<?> interfaces[] = mbean.getClass().getInterfaces(); Class<?>[] interfaces = mbean.getClass().getInterfaces();
for (Class<?> i : interfaces) { for (Class<?> i : interfaces) {
register = SystemReader.getInstance().getUserConfig() register = SystemReader.getInstance().getUserConfig()
.getBoolean( .getBoolean(

View File

@ -45,7 +45,7 @@
* @since 4.7 * @since 4.7
*/ */
public class SHA1 { public class SHA1 {
private static Logger LOG = LoggerFactory.getLogger(SHA1.class); private static final Logger LOG = LoggerFactory.getLogger(SHA1.class);
private static final boolean DETECT_COLLISIONS; private static final boolean DETECT_COLLISIONS;
static { static {