Преглед на файлове

Suppress boxing warnings where we know they are ok

Invoke the wrapper types' valueOf via static imports.
For booleans used in asserts, add a new assert in
the JUnit utility package since out current version of JUnit
does not have the assert(boolean, boolean) method.

Change-Id: I9099bd8efbc8c133479344d51ce7dabed8958a2b
tags/v2.2.0.201212191850-r
Robin Rosenberg преди 11 години
родител
ревизия
c3f1fac03f
променени са 26 файла, в които са добавени 163 реда и са изтрити 50 реда
  1. 7
    2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java
  2. 3
    1
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CQ.java
  3. 58
    0
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/Assert.java
  4. 4
    1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
  5. 5
    1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
  6. 10
    7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java
  7. 3
    2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
  8. 3
    1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  9. 10
    5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
  10. 5
    2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
  11. 4
    1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  12. 5
    2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
  13. 3
    1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
  14. 6
    3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
  15. 1
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
  16. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java
  17. 1
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
  18. 5
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
  19. 5
    4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
  20. 1
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
  21. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
  22. 8
    6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
  23. 7
    6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java
  24. 1
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java
  25. 5
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
  26. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java

+ 7
- 2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java Целия файл

import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;


import static java.lang.Integer.valueOf;

import org.eclipse.jgit.http.server.HttpServerText; import org.eclipse.jgit.http.server.HttpServerText;


/** /**
*/ */
public RegexGroupFilter(final int groupIdx) { public RegexGroupFilter(final int groupIdx) {
if (groupIdx < 1) if (groupIdx < 1)
throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().invalidIndex, groupIdx));
throw new IllegalArgumentException(MessageFormat.format(
HttpServerText.get().invalidIndex, valueOf(groupIdx)));
this.groupIdx = groupIdx - 1; this.groupIdx = groupIdx - 1;
} }


if (groupIdx < g.length) if (groupIdx < g.length)
chain.doFilter(g[groupIdx], rsp); chain.doFilter(g[groupIdx], rsp);
else else
throw new ServletException(MessageFormat.format(HttpServerText.get().invalidRegexGroup, (groupIdx + 1)));
throw new ServletException(MessageFormat.format(
HttpServerText.get().invalidRegexGroup,
valueOf(groupIdx + 1)));
} }


private static WrappedRequest[] groupsFor(final ServletRequest r) { private static WrappedRequest[] groupsFor(final ServletRequest r) {

+ 3
- 1
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CQ.java Целия файл



package org.eclipse.jgit.iplog; package org.eclipse.jgit.iplog;


import static java.lang.Long.valueOf;

import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Comparator; import java.util.Comparator;




@Override @Override
public String toString() { public String toString() {
return MessageFormat.format(IpLogText.get().CQString, getID());
return MessageFormat.format(IpLogText.get().CQString, valueOf(getID()));
} }
} }

+ 58
- 0
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/Assert.java Целия файл

/*
* Copyright (C) 2012, Robin Rosenberg
* and other copyright owners as documented in the project's IP log.
*
* 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
*
* 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.
*/
package org.eclipse.jgit.junit;

import static java.lang.Boolean.valueOf;

public class Assert {

public static void assertEquals(boolean expect, boolean actual) {
org.junit.Assert.assertEquals(valueOf(expect), valueOf(actual));
}

public static void assertEquals(String message, boolean expect,
boolean actual) {
org.junit.Assert
.assertEquals(message, valueOf(expect), valueOf(actual));
}
}

+ 4
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java Целия файл



package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;


import static java.lang.Character.valueOf;

import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.text.MessageFormat; import java.text.MessageFormat;
shownURI = true; shownURI = true;
} }


outw.format(" %c %-17s %-10s -> %s", type, longType, src, dst);
outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType,
src, dst);
outw.println(); outw.println();
} }
} finally { } finally {

+ 5
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java Целия файл



package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;


import static java.lang.Integer.valueOf;

import java.io.EOFException; import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
while (len > 0) { while (len > 0) {
final int n = in.read(tmp); final int n = in.read(tmp);
if (n < 0) if (n < 0)
throw new EOFException(MessageFormat.format(CLIText.get().expectedNumberOfbytes, len));
throw new EOFException(MessageFormat.format(
CLIText.get().expectedNumberOfbytes,
valueOf(len)));
outs.write(tmp, 0, n); outs.write(tmp, 0, n);
len -= n; len -= n;
} }

+ 10
- 7
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java Целия файл



package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;


import java.io.File; import java.io.File;
maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line));
} }


String pathFmt = MessageFormat.format(" %{0}s", pathWidth);
String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth));
String numFmt = MessageFormat.format(" %{0}d", String numFmt = MessageFormat.format(" %{0}d",
1 + (int) Math.log10(maxSourceLine + 1));
valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
String lineFmt = MessageFormat.format(" %{0}d) ", String lineFmt = MessageFormat.format(" %{0}d) ",
1 + (int) Math.log10(end + 1));
valueOf(1 + (int) Math.log10(end + 1)));
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", String authorFmt = MessageFormat.format(" (%-{0}s %{1}s",
authorWidth, dateWidth);
valueOf(authorWidth), valueOf(dateWidth));


for (int line = begin; line < end; line++) { for (int line = begin; line < end; line++) {
outw.print(abbreviate(blame.getSourceCommit(line))); outw.print(abbreviate(blame.getSourceCommit(line)));
if (showSourcePath) if (showSourcePath)
outw.format(pathFmt, path(line)); outw.format(pathFmt, path(line));
if (showSourceLine) if (showSourceLine)
outw.format(numFmt, blame.getSourceLine(line) + 1);
outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1));
if (!noAuthor) if (!noAuthor)
outw.format(authorFmt, author(line), date(line)); outw.format(authorFmt, author(line), date(line));
outw.format(lineFmt, line + 1);
outw.format(lineFmt, valueOf(line + 1));
outw.flush(); outw.flush();
blame.getResultContents().writeLine(outs, line); blame.getResultContents().writeLine(outs, line);
outs.flush(); outs.flush();
dateFmt.setTimeZone(author.getTimeZone()); dateFmt.setTimeZone(author.getTimeZone());
if (!showRawTimestamp) if (!showRawTimestamp)
return dateFmt.format(author.getWhen()); return dateFmt.format(author.getWhen());
return String.format("%d %s", author.getWhen().getTime() / 1000L,
return String.format("%d %s",
valueOf(author.getWhen().getTime() / 1000L),
dateFmt.format(author.getWhen())); dateFmt.format(author.getWhen()));
} }



+ 3
- 2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java Целия файл



package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;


import static java.lang.Integer.valueOf;
import static org.eclipse.jgit.lib.Constants.HEAD; import static org.eclipse.jgit.lib.Constants.HEAD;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;


out.println("M\t" + ent.getNewPath()); out.println("M\t" + ent.getNewPath());
break; break;
case COPY: case COPY:
out.format("C%1$03d\t%2$s\t%3$s", ent.getScore(), //
out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
ent.getOldPath(), ent.getNewPath()); ent.getOldPath(), ent.getNewPath());
out.println(); out.println();
break; break;
case RENAME: case RENAME:
out.format("R%1$03d\t%2$s\t%3$s", ent.getScore(), //
out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
ent.getOldPath(), ent.getNewPath()); ent.getOldPath(), ent.getNewPath());
out.println(); out.println();
break; break;

+ 3
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java Целия файл



package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;


import static java.lang.Character.valueOf;

import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
private void printUpdateLine(final char flag, final String summary, private void printUpdateLine(final char flag, final String summary,
final String srcRef, final String destRef, final String message) final String srcRef, final String destRef, final String message)
throws IOException { throws IOException {
outw.format(" %c %-17s", flag, summary);
out.format(" %c %-17s", valueOf(flag), summary);


if (srcRef != null) if (srcRef != null)
outw.format(" %s ->", abbreviateRef(srcRef, true)); outw.format(" %s ->", abbreviateRef(srcRef, true));

+ 10
- 5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;

import java.io.File; import java.io.File;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean; import java.lang.management.ThreadMXBean;
outw.println(name + ": start at " + startId.name()); outw.println(name + ": start at " + startId.name());
} }


outw.format(" %12d files, %8d commits\n", files, commits);
outw.format(" N=%10d min lines, %8d max lines\n", minN, maxN);
outw.format(" %12d files, %8d commits\n", valueOf(files),
valueOf(commits));
outw.format(" N=%10d min lines, %8d max lines\n", valueOf(minN),
valueOf(maxN));


outw.format("%-25s %12s ( %12s %12s )\n", // outw.format("%-25s %12s ( %12s %12s )\n", //
"Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); "Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on");
for (Test test : all) { for (Test test : all) {
outw.format("%-25s %12d ( %12d %12d )", // outw.format("%-25s %12d ( %12d %12d )", //
test.algorithm.name, // test.algorithm.name, //
test.runningTimeNanos, //
test.minN.runningTimeNanos, //
test.maxN.runningTimeNanos);
valueOf(test.runningTimeNanos), //
valueOf(test.minN.runningTimeNanos), //
valueOf(test.maxN.runningTimeNanos));
outw.println(); outw.println();
} }
outw.println(); outw.println();

+ 5
- 2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Integer.valueOf;

import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;


} }


private void show(final DirCacheTree tree) throws IOException { private void show(final DirCacheTree tree) throws IOException {
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
, tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
tree.getPathString(), valueOf(tree.getEntrySpan()),
valueOf(tree.getChildCount())));


for (int i = 0; i < tree.getChildCount(); i++) for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i)); show(tree.getChild(i));

+ 4
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Long.valueOf;

import java.text.MessageFormat; import java.text.MessageFormat;


import org.eclipse.jgit.pgm.CLIText; import org.eclipse.jgit.pgm.CLIText;
db.readDirCache(); db.readDirCache();
final long end = System.currentTimeMillis(); final long end = System.currentTimeMillis();
outw.print(" "); outw.print(" ");
outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, (end - start) / cnt));
outw.println(MessageFormat.format(CLIText.get().averageMSPerRead,
valueOf((end - start) / cnt)));
} }
} }

+ 5
- 2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Integer.valueOf;

import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;


} }


private void show(final DirCacheTree tree) throws IOException { private void show(final DirCacheTree tree) throws IOException {
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
, tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
tree.getPathString(), valueOf(tree.getEntrySpan()),
valueOf(tree.getChildCount())));


for (int i = 0; i < tree.getChildCount(); i++) for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i)); show(tree.getChild(i));

+ 3
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Integer.valueOf;

import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;


final int stage = ent.getStage(); final int stage = ent.getStage();


outw.print(mode); outw.print(mode);
outw.format(" %6d", len);
outw.format(" %6d", valueOf(len));
outw.print(' '); outw.print(' ');
outw.print(fmt.format(mtime)); outw.print(fmt.format(mtime));
outw.print(' '); outw.print(' ');

+ 6
- 3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java Целия файл



package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;

import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.security.MessageDigest; import java.security.MessageDigest;
outw.println(name + ":"); outw.println(name + ":");
} }
outw.format(" %6d files; %5d avg. unique lines/file\n", // outw.format(" %6d files; %5d avg. unique lines/file\n", //
fileCnt, //
lineCnt / fileCnt);
valueOf(fileCnt), //
valueOf(lineCnt / fileCnt));
outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len");
outw.println("-----------------------------------------------"); outw.println("-----------------------------------------------");
String lastHashName = null; String lastHashName = null;
outw.format("%-20s %-15s %9d\n", // outw.format("%-20s %-15s %9d\n", //
hashName, // hashName, //
fun.fold.name, // fun.fold.name, //
fun.maxChainLength);
valueOf(fun.maxChainLength));
lastHashName = fun.hash.name; lastHashName = fun.hash.name;
} }
outw.println(); outw.println();

+ 1
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java Целия файл



package org.eclipse.jgit.dircache; package org.eclipse.jgit.dircache;


import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java Целия файл



package org.eclipse.jgit.fnmatch; package org.eclipse.jgit.fnmatch;


import static org.junit.Assert.assertEquals;
import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

+ 1
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java Целия файл

*/ */
package org.eclipse.jgit.ignore; package org.eclipse.jgit.ignore;


import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;

+ 5
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java Целия файл



package org.eclipse.jgit.lib; package org.eclipse.jgit.lib;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;


fail("Did not throw CorruptObjectException"); fail("Did not throw CorruptObjectException");
} catch (CorruptObjectException e) { } catch (CorruptObjectException e) {
final String m = e.getMessage(); final String m = e.getMessage();
assertEquals(MessageFormat.format(JGitText.get().corruptObjectInvalidType2, Constants.OBJ_BAD), m);
assertEquals(MessageFormat.format(
JGitText.get().corruptObjectInvalidType2,
valueOf(Constants.OBJ_BAD)), m);
} }
} }



+ 5
- 4
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java Целия файл

*/ */
package org.eclipse.jgit.lib; package org.eclipse.jgit.lib;


import static java.lang.Long.valueOf;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;


if (i == 5) if (i == 5)
fsTick(lastFile); fsTick(lastFile);
} }
modTimes.add(fsTick(lastFile));
modTimes.add(valueOf(fsTick(lastFile)));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
lastFile = new File(db.getWorkTree(), "1." + i); lastFile = new File(db.getWorkTree(), "1." + i);
FileUtils.createNewFile(lastFile); FileUtils.createNewFile(lastFile);
} }
modTimes.add(fsTick(lastFile));
modTimes.add(valueOf(fsTick(lastFile)));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
lastFile = new File(db.getWorkTree(), "2." + i); lastFile = new File(db.getWorkTree(), "2." + i);
FileUtils.createNewFile(lastFile); FileUtils.createNewFile(lastFile);


// wait to ensure that modtimes of the file doesn't match last index // wait to ensure that modtimes of the file doesn't match last index
// file modtime // file modtime
modTimes.add(fsTick(db.getIndexFile()));
modTimes.add(valueOf(fsTick(db.getIndexFile())));


// create two files // create two files
addToWorkDir("a", "a"); addToWorkDir("a", "a");


// wait to ensure that file-modTimes and therefore index entry modTime // wait to ensure that file-modTimes and therefore index entry modTime
// doesn't match the modtime of index-file after next persistance // doesn't match the modtime of index-file after next persistance
modTimes.add(fsTick(lastFile));
modTimes.add(valueOf(fsTick(lastFile)));


// now add both files to the index. No racy git expected // now add both files to the index. No racy git expected
resetIndex(new FileTreeIteratorWithTimeControl(db, modTimes)); resetIndex(new FileTreeIteratorWithTimeControl(db, modTimes));

+ 1
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java Целия файл



package org.eclipse.jgit.lib; package org.eclipse.jgit.lib;


import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java Целия файл



package org.eclipse.jgit.lib; package org.eclipse.jgit.lib;


import static org.junit.Assert.assertEquals;
import static org.eclipse.jgit.junit.Assert.assertEquals;


import org.junit.Test; import org.junit.Test;



+ 8
- 6
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java Целия файл



package org.eclipse.jgit.patch; package org.eclipse.jgit.patch;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
{ {
final FormatError e = p.getErrors().get(0); final FormatError e = p.getErrors().get(0);
assertSame(FormatError.Severity.ERROR, e.getSeverity()); assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals(
MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 1, 1),
e.getMessage());
assertEquals(MessageFormat.format(
JGitText.get().truncatedHunkLinesMissingForAncestor,
valueOf(1), valueOf(1)), e.getMessage());
assertEquals(346, e.getOffset()); assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith( assertTrue(e.getLineText().startsWith(
"@@@ -55,12 -163,13 +163,15 @@@ public ")); "@@@ -55,12 -163,13 +163,15 @@@ public "));
{ {
final FormatError e = p.getErrors().get(1); final FormatError e = p.getErrors().get(1);
assertSame(FormatError.Severity.ERROR, e.getSeverity()); assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals(
MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 2, 2),
e.getMessage());
assertEquals(MessageFormat.format(
JGitText.get().truncatedHunkLinesMissingForAncestor,
valueOf(2), valueOf(2)), e.getMessage());
assertEquals(346, e.getOffset()); assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith( assertTrue(e.getLineText().startsWith(
"@@@ -55,12 -163,13 +163,15 @@@ public ")); "@@@ -55,12 -163,13 +163,15 @@@ public "));

+ 7
- 6
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java Целия файл

*/ */
package org.eclipse.jgit.storage.file; package org.eclipse.jgit.storage.file;


import static java.lang.Integer.valueOf;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
syncPoint.await(); syncPoint.await();
try { try {
gc.packRefs(); gc.packRefs();
return 0;
return valueOf(0);
} catch (IOException e) { } catch (IOException e) {
return 1;
return valueOf(1);
} }
} }
}; };
try { try {
Future<Integer> p1 = pool.submit(packRefs); Future<Integer> p1 = pool.submit(packRefs);
Future<Integer> p2 = pool.submit(packRefs); Future<Integer> p2 = pool.submit(packRefs);
assertTrue(p1.get() + p2.get() == 1);
assertEquals(1, p1.get().intValue() + p2.get().intValue());
} finally { } finally {
pool.shutdown(); pool.shutdown();
pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
try { try {
gc.setProgressMonitor(this); gc.setProgressMonitor(this);
gc.repack(); gc.repack();
return 0;
return valueOf(0);
} catch (IOException e) { } catch (IOException e) {
// leave the syncPoint in broken state so any awaiting // leave the syncPoint in broken state so any awaiting
// threads and any threads that call await in the future get // threads and any threads that call await in the future get
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
// //
} }
return 1;
return valueOf(1);
} }
} }
} }
DoRepack repack2 = new DoRepack(); DoRepack repack2 = new DoRepack();
Future<Integer> result1 = pool.submit(repack1); Future<Integer> result1 = pool.submit(repack1);
Future<Integer> result2 = pool.submit(repack2); Future<Integer> result2 = pool.submit(repack2);
assertTrue(result1.get() + result2.get() == 0);
assertEquals(0, result1.get().intValue() + result2.get().intValue());
} finally { } finally {
pool.shutdown(); pool.shutdown();
pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);

+ 1
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java Целия файл



package org.eclipse.jgit.storage.file; package org.eclipse.jgit.storage.file;


import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;

+ 5
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java Целия файл



package org.eclipse.jgit.transport; package org.eclipse.jgit.transport;


import static java.lang.Integer.valueOf;
import static java.lang.Long.valueOf;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS;
new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut); new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut);
fail("Accepted " + Integer.MAX_VALUE + " for buffer size"); fail("Accepted " + Integer.MAX_VALUE + " for buffer size");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
assertEquals(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, Integer.MAX_VALUE, 65520), e.getMessage());
assertEquals(MessageFormat.format(
JGitText.get().packetSizeMustBeAtMost,
valueOf(Integer.MAX_VALUE), valueOf(65520)), e.getMessage());
} }
} }



+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java Целия файл



package org.eclipse.jgit.treewalk.filter; package org.eclipse.jgit.treewalk.filter;


import static org.junit.Assert.assertEquals;
import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;

Loading…
Отказ
Запис