Browse Source

Merge changes Ic0ee9c08,Ia3e82682,I8d8ab547,I8f2cd0a0,I45823b0c,Ie22ac47e

* changes:
  cleanup: Silence an unused-parameter warning
  cleanup: Get rid of some unused-warnings
  cleanup: Remove unused parameter in ConsoleCredentialsProvider
  cleanup: Drop unused parameter on DhtPackParser
  cleanup: Remove unneeded parameter to private method in RefUpdateTest
  cleanup: Remove unnecessary @SuppressWarnings
stable-2.0
Shawn Pearce 13 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
0a69f05647
  1. 16
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
  2. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java
  3. 1
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
  4. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java
  5. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  6. 8
      org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtPackParser.java
  7. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java
  8. 1
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java
  9. 1
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java
  10. 1
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryBuilder.java

16
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java

@ -99,16 +99,16 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
CredentialItem item = items[i];
if (item instanceof CredentialItem.StringType)
ok = get(uri, (CredentialItem.StringType) item);
ok = get((CredentialItem.StringType) item);
else if (item instanceof CredentialItem.CharArrayType)
ok = get(uri, (CredentialItem.CharArrayType) item);
ok = get((CredentialItem.CharArrayType) item);
else if (item instanceof CredentialItem.YesNoType)
ok = get(uri, (CredentialItem.YesNoType) item);
ok = get((CredentialItem.YesNoType) item);
else if (item instanceof CredentialItem.InformationalMessage)
ok = get(uri, (CredentialItem.InformationalMessage) item);
ok = get((CredentialItem.InformationalMessage) item);
else
throw new UnsupportedCredentialItem(uri, item.getPromptText());
@ -116,7 +116,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
return ok;
}
private boolean get(URIish uri, CredentialItem.StringType item) {
private boolean get(CredentialItem.StringType item) {
if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText());
if (v != null) {
@ -136,7 +136,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
}
}
private boolean get(URIish uri, CredentialItem.CharArrayType item) {
private boolean get(CredentialItem.CharArrayType item) {
if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText());
if (v != null) {
@ -156,13 +156,13 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
}
}
private boolean get(URIish uri, CredentialItem.InformationalMessage item) {
private boolean get(CredentialItem.InformationalMessage item) {
cons.printf("%s\n", item.getPromptText());
cons.flush();
return true;
}
private boolean get(URIish uri, CredentialItem.YesNoType item) {
private boolean get(CredentialItem.YesNoType item) {
String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(),
ConsoleText.get().answerYes, ConsoleText.get().answerNo);
if (r != null) {

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java

@ -138,7 +138,6 @@ public class GitServlet extends MetaServlet {
* the factory to construct and configure an {@link UploadPack}
* session when a fetch or clone is requested by a client.
*/
@SuppressWarnings("unchecked")
public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) {
gitFilter.setUploadPackFactory(f);
}
@ -158,7 +157,6 @@ public class GitServlet extends MetaServlet {
* the factory to construct and configure a {@link ReceivePack}
* session when a push is requested by a client.
*/
@SuppressWarnings("unchecked")
public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) {
gitFilter.setReceivePackFactory(f);
}

1
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java

@ -184,6 +184,7 @@ public class RecordingLogger implements Logger {
// Ignore (not relevant to test failures)
}
@SuppressWarnings("unused")
public void ignore(Throwable arg0) {
// Ignore (not relevant to test failures)
}

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

@ -65,7 +65,7 @@ class Fetch extends AbstractFetchCommand {
private Boolean fsck;
@Option(name = "--no-fsck")
void nofsck(final boolean ignored) {
void nofsck(@SuppressWarnings("unused") final boolean ignored) {
fsck = Boolean.FALSE;
}
@ -79,7 +79,7 @@ class Fetch extends AbstractFetchCommand {
private Boolean thin;
@Option(name = "--no-thin")
void nothin(final boolean ignored) {
void nothin(@SuppressWarnings("unused") final boolean ignored) {
thin = Boolean.FALSE;
}

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java

@ -89,7 +89,7 @@ class Push extends TextBuiltin {
private boolean thin = Transport.DEFAULT_PUSH_THIN;
@Option(name = "--no-thin")
void nothin(final boolean ignored) {
void nothin(@SuppressWarnings("unused") final boolean ignored) {
thin = false;
}

8
org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtPackParser.java

@ -1016,11 +1016,11 @@ public class DhtPackParser extends PackParser {
break;
case OBJ_TREE:
onTree(info, data);
onTree(data);
break;
case OBJ_TAG:
onTag(info, data);
onTag(data);
break;
}
}
@ -1045,7 +1045,7 @@ public class DhtPackParser extends PackParser {
}
}
private void onTree(DhtInfo obj, byte[] data) {
private void onTree(byte[] data) {
if (isSaveAsCachedPack()) {
treeParser.reset(data);
while (!treeParser.eof()) {
@ -1056,7 +1056,7 @@ public class DhtPackParser extends PackParser {
}
}
private void onTag(DhtInfo obj, byte[] data) {
private void onTag(byte[] data) {
if (isSaveAsCachedPack()) {
idBuffer.fromString(data, 7); // "object $sha1"
lookupByName(idBuffer).setReferenced();

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java

@ -616,7 +616,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
ObjectId oldHead = db.resolve(Constants.HEAD);
assertFalse("precondition for this test, branch b != HEAD", rb
.equals(oldHead));
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -640,7 +640,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
writeSymref(Constants.HEAD, "refs/heads/b");
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue("internal test condition, b == HEAD", rb.equals(oldHead));
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -669,7 +669,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
Result update = updateRef.update();
assertEquals("internal check new ref is loose", Result.FORCED, update);
assertEquals(Ref.Storage.LOOSE, db.getRef("refs/heads/b").getStorage());
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -699,8 +699,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
writeSymref(Constants.HEAD, headPointsTo);
ObjectId oldfromId = db.resolve(fromName);
ObjectId oldHeadId = db.resolve(Constants.HEAD);
writeReflog(db, oldfromId, oldfromId, "Just a message",
fromName);
writeReflog(db, oldfromId, "Just a message", fromName);
List<org.eclipse.jgit.storage.file.ReflogEntry> oldFromLog = db
.getReflogReader(fromName).getReverseEntries();
List<org.eclipse.jgit.storage.file.ReflogEntry> oldHeadLog = oldHeadId != null ? db
@ -806,7 +805,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
assertEquals(Result.FAST_FORWARD, updateRef.update());
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue(rb.equals(oldHead)); // assumption for this test
writeReflog(db, rb, rb, "Just a message", "refs/heads/a");
writeReflog(db, rb, "Just a message", "refs/heads/a");
assertTrue("internal check, we have a log", new File(db.getDirectory(),
"logs/refs/heads/a").exists());
@ -840,8 +839,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
assertEquals(Result.FORCED, updateRef.update());
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue(rb.equals(oldHead)); // assumption for this test
writeReflog(db, rb, rb, "Just a message",
"refs/heads/prefix/a");
writeReflog(db, rb, "Just a message", "refs/heads/prefix/a");
assertTrue("internal check, we have a log", new File(db.getDirectory(),
"logs/refs/heads/prefix/a").exists());
@ -864,8 +862,8 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
"HEAD").getReverseEntries().get(0).getComment());
}
private void writeReflog(Repository db, ObjectId oldId, ObjectId newId,
String msg, String refName) throws IOException {
private void writeReflog(Repository db, ObjectId newId, String msg,
String refName) throws IOException {
RefDirectory refs = (RefDirectory) db.getRefDatabase();
RefDirectoryUpdate update = refs.newUpdate(refName, true);
update.setNewObjectId(newId);

1
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java

@ -524,7 +524,6 @@ public final class DfsBlockCache {
return true;
}
@SuppressWarnings("unchecked")
private <T> T scan(HashEntry n, DfsPackKey pack, long position) {
Ref<T> r = scanRef(n, pack, position);
return r != null ? r.get() : null;

1
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java

@ -541,7 +541,6 @@ final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
}
}
@SuppressWarnings("unchecked")
public Collection<CachedPack> getCachedPacks() throws IOException {
DfsPackFile[] packList = db.getPacks();
List<CachedPack> cached = new ArrayList<CachedPack>(packList.length);

1
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryBuilder.java

@ -120,7 +120,6 @@ public abstract class DfsRepositoryBuilder<B extends DfsRepositoryBuilder, R ext
* the repository could not be accessed to configure the rest of
* the builder's parameters.
*/
@SuppressWarnings("unchecked")
@Override
public abstract R build() throws IOException;

Loading…
Cancel
Save